home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / Allway Sync / allwaysync-2-0-6.exe / {app} / Skins / default / profileex.js < prev    next >
Text File  |  2005-02-28  |  105KB  |  2,734 lines

  1. // JavaScript Document
  2.  
  3. //    Constants:
  4. C_ERR_QUESTION = 6000;
  5. C_CID = 'F3BDCACCA95444D6BBF419FDC8367C08';
  6. C_ACTION_STATE_INIT = '43F4376C08254CE03299AB694B7A4E75';
  7. C_ACTION_STATE_IN_PROGRESS = '58F511A98452E0FABC4099C03A33AB24';
  8. C_ACTION_STATE_DONE = '9C2D0F16C7009B482E33617B81A6417E';
  9. C_AssociationTemplate = '';
  10. C_MESSAGES_ON_PAGE = 16;
  11. //    Global variables:
  12. G_OnProfileChanged_called = false;
  13. G_OnAssociationChanged_called = false;
  14. G_CounterRefreshFlag = true;
  15. G_AnalyzeHintCallCounter = 4;
  16. G_Folders_is_ready = false;
  17. //G_SynchronizeHintCallCounter = 3;
  18. G_TabScrollingProcessNum = 0;
  19. G_ActiveAssociationID = '';
  20. G_Associations = new Array();
  21. G_LastAssociationNumber = 1;
  22. G_ProfileExist = false;
  23.  
  24.  
  25. G_FirstAssociationID = '';
  26. Flag_can_reload_profile = true;
  27.  
  28. function CreateTree(AssociationID, name,spanid) // main TreeView object
  29. {
  30.     this._name=name;               // name of object
  31.     this._spanid=spanid;           // id of existing div used for treeview
  32.       this._associationID = AssociationID;
  33.     this._collections = new Array();
  34.     this._collectionIdByName = new Array();
  35.     this._image_collapsed="Pics/collapsed.gif";// images for parent nodes
  36.       this._image_expanded="Pics/expanded.gif";
  37.       this.root={    _id:name+"_root",   // main node properties
  38.                  _childrencount:0,
  39.                  _children:[]      // children array
  40.                 };
  41.  
  42.   this.build_root=function()
  43.       {
  44.     html_code = '<div id="'+this.root._id+'" >\n';    
  45.     for(i in this.root._children)
  46.         {
  47.         html_code += this.build_collection(i);
  48.         }
  49.       html_code +='</div>';
  50.     return html_code;
  51.     };
  52.  
  53.   this.build_collection=function(CollectionID)
  54.       {
  55.     if(this._collections[CollectionID].name == 'Important')
  56.         {
  57.         Is_important_messages = true;
  58.         }
  59.         else
  60.         {
  61.         Is_important_messages = false;
  62.         }
  63.     var collection = this.root._children[CollectionID];
  64.     var collection_html = '<div id="'+CollectionID+'">'; 
  65. //    msgs = external.ObjByID(CollectionID);
  66.     var msgs = this._collections[CollectionID].obj;
  67.     var CollectionChildrenCount = msgs.Method0('M_GetCount');
  68.     var AdditionalAttributes = msgs.Method0Own('M_GetAdditionalAttributeMap');    
  69.     if(CollectionChildrenCount > 0)    //Children exists, collection._empty == false
  70.         {
  71.         Important_sign = "";
  72.         if(Is_important_messages == true)
  73.             {
  74.             var AssociationElement = document.getElementById('Association_'+this._associationID);
  75.             AssociationElement.all['Important_warning'].style.visibility = "inherit";
  76.             var Important_sign = '<span><img src="Pics/warning_small.gif"></span> ';
  77.             }
  78.         collection._empty = false;
  79.         if(collection._expanded == 1)
  80.             {
  81.             var sub_collection_html = "";
  82.             var Prev_html = "";
  83.             var Next_html = "";
  84.             var firstMsgID = collection._first_disp_msg;
  85.             if(firstMsgID == null)
  86.                 {
  87.                 var msg = msgs.GetFirst();
  88.                 if(msg != null)
  89.                     {
  90.                     collection._first_disp_msg = msg.objID;
  91.                     collection._first_disp_msg_evenness = 1;
  92.                     msg.SetM(CollectionID, 1);    //???
  93.                     }
  94.                     else
  95.                     {
  96.                     collection._empty = true;
  97.                     AdditionalAttributes.SetM('MM_FlagNotifyScript', true);        
  98.                     collection_html += '</div>\n\n';
  99.                     return collection_html;
  100.                     }
  101.                 }
  102.                 else
  103.                 {
  104.                 var msg = msgs.ObjByID(firstMsgID);
  105.                 }
  106.             if(msgs.GetPrev(msg) != null) 
  107.                 {
  108.                 var Prev_exist = true;
  109.                 }
  110.                 else
  111.                 {
  112.                 var Prev_exist = false;
  113.                 }
  114.             //alert('Prev_html = '+Prev_html);
  115.             var i=0;
  116.             while((i < C_MESSAGES_ON_PAGE) && (msg!=null))
  117.                 {
  118.                 MsgEvenness = (collection._first_disp_msg_evenness+i)%2;
  119.                 sub_collection_html += this.build_message(CollectionID,msg.objID, MsgEvenness);
  120.                 i++;
  121.                 msg = msgs.GetNext(msg);
  122.                 }    
  123.             if((i==C_MESSAGES_ON_PAGE)&&(msg!=null))
  124.                 {
  125.                 var Next_exist = true;
  126.                 AdditionalAttributes.SetM('MM_FlagNotifyScript', false);
  127.                 }
  128.                 else
  129.                 {
  130.                 var Next_exist = false;
  131.                 AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
  132.                 }
  133.             if((Prev_exist)||(Next_exist))
  134.                 {
  135.                 var MsgScrollersExist = true;
  136.                 }
  137.                 else
  138.                 {
  139.                 var MsgScrollersExist = false;
  140.                 }
  141.             Prev_html = new CreateScrollControls("prev", Prev_exist, CollectionID, MsgScrollersExist);
  142.             Next_html = new CreateScrollControls("next", Next_exist, CollectionID, MsgScrollersExist);
  143.             //alert('Next_html = '+Next_html);
  144.             collection_html+='\n<div id="'+CollectionID+'_in" style="width:100%; position:relative; left:0;">\n'+
  145.                         '<table class="ParentNode" border="0" cellpadding="0" cellspacing="0"><tr><td valign=middle align=center >'+
  146.                             '<div style="width:30px;"><img onclick="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" src="'+this._image_expanded+'"></div></td><td nowrap>'+    
  147.                          '<span class="CollectionName" onclick="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" style="cursor:hand;">'+Important_sign+collection._caption+' (<span id="'+    
  148.                          CollectionID+'_caption">'+CollectionChildrenCount+'</span>)</span>';
  149.                collection_html+='</td><td width="100%"></td>'+
  150.                         '<td id="TopPrev_end" valign="bottom" >'+Prev_html.top_end+'</td>'+
  151.                         '<td id="TopPrev_page" valign="bottom" >'+Prev_html.top_page+'</td>'+
  152.                         '<td id="TopPrev_msg" valign="bottom" >'+Prev_html.top_msg+'</td>'+
  153.                         '<td id="TopNext_msg" valign="bottom" >'+Next_html.top_msg+'</td>'+
  154.                         '<td id="TopNext_page" valign="bottom" >'+Next_html.top_page+'</td>'+
  155.                         '<td id="TopNext_end" valign="bottom" >'+Next_html.top_end+'</td>'+
  156.                         '</tr></table></div>\n';
  157.             collection_html += ''+ /*'<div class="MessageList"> '+*/
  158.                 '<table class="MessageList" border="0" cellspacing="0" cellpadding="0"><tr>'+
  159.                 '<td class="MsgCollectionScrollBar" style="width:16px; height:100%;">'+
  160.                         '<table height="100%" width="16px" border="0" cellpadding="0" cellspacing="0" id="'+CollectionID+'_ScrollBar">'+
  161.                             '<tr><td id="Prev_end">'+Prev_html.end+'</td></tr>'+
  162.                             '<tr><td id="Prev_page">'+Prev_html.page+'</td></tr>'+
  163.                             '<tr><td id="Prev_msg">'+Prev_html.msg+'</td></tr>'+        
  164.                             '<tr height="100%"><td height="100%"></td></tr>'+
  165.                             '<tr><td id="Next_msg">'+Next_html.msg+'</td></tr>'+
  166.                             '<tr><td id="Next_page">'+Next_html.page+'</td></tr>'+
  167.                             '<tr><td id="Next_end">'+Next_html.end+'</td></tr>'+
  168.                         '</table>'+
  169.                         '</td>';
  170.             collection_html += '<td width="100%"><table id="'+CollectionID+'_container" width="100%" border="0" cellspacing="0" cellpadding="0" class="Collection_Table">'
  171.                     +sub_collection_html+'</table></td></tr></table>'; //</div>
  172.             }
  173.         if(collection._expanded==0)
  174.             {
  175.             collection_html+='\n<div id="'+CollectionID+'_in" style="width:100%; position:relative; left:0;">\n'+
  176.                         '<table class="ParentNode" border="0" cellpadding="0" cellspacing="0"><tr><td valign=middle align=center>'+
  177.                             '<div style="width:30px;"><img  onclick="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" src="'+this._image_collapsed+'"></div></td><td nowrap>'+    
  178.                          '<span class="CollectionName" onclick="OnCollectionExpandIconClick(\''+this._associationID+'\',\''+CollectionID+'\');" style="cursor:hand;">'+Important_sign+collection._caption+' (<span id="'+    
  179.                          CollectionID+'_caption">'+CollectionChildrenCount+'</span>)</span> ';
  180.             collection_html+='</td><td width="100%"></td></tr></table></div>\n';
  181.             AdditionalAttributes.SetM('MM_FlagNotifyScript', false);
  182.             }
  183.         }
  184.         else //CollectionChildrenCount == 0
  185.         {
  186.         if(Is_important_messages == true)
  187.             {
  188.             AssociationElement = document.getElementById('Association_'+this._associationID);
  189.             AssociationElement.all['Important_warning'].style.visibility = "hidden";
  190.             }
  191.         collection._empty = true;
  192.         collection._first_disp_msg = null;
  193.         AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
  194.         }                
  195.     collection_html += '</div>\n\n';
  196.     return collection_html;
  197.     };
  198.  
  199.   this.build_message=function(CollectionID, MsgID, MsgEvenness)
  200.       {
  201.     var msg = external.ObjByID(MsgID);
  202.     var message_html = FillMsgNode(msg, MsgEvenness);  
  203.     msg.SetM(CollectionID, 1);    //MM_FlagNotifyScript to 1
  204.     return message_html;
  205.     };
  206.  
  207.  
  208.   this.redraw=function()  // function redraws whole treeview
  209.   {
  210.     var AssociationElement = document.getElementById('Association_'+this._associationID);
  211.     var ele = AssociationElement.all[this._spanid];
  212.     ele.innerHTML = this.build_root();
  213.   };
  214.   
  215.   this.redraw_collection=function(CollectionID)
  216.   {
  217.     var AssociationElement = document.getElementById('Association_'+this._associationID);
  218.       var collection_element = AssociationElement.all[CollectionID];
  219.       collection_element.outerHTML = this.build_collection(CollectionID);
  220.   };
  221.            
  222.   this.add_collection_node=function(msgs, collectionName, caption, expanded)      // adds node
  223.   {
  224.     var CollectionID = msgs.objID;
  225.     this._collections[CollectionID] = {};
  226.     this._collections[CollectionID].obj = msgs;
  227.     this._collections[CollectionID].name = collectionName;
  228.     this._collectionIdByName[collectionName] = CollectionID;
  229.     var collection_node={};
  230.     collection_node._caption=caption;
  231.     collection_node._expanded=expanded;
  232. //     msgs = external.ObjByID(CollectionID);
  233.     if(expanded == 1)
  234.         {
  235.         var NotifyFlag = true;
  236.         }
  237.         else
  238.         {
  239.         var NotifyFlag = false;
  240.         }
  241.     if(msgs == null)
  242.         {
  243.         alert('add_collection_node: CollectionObj (msgs) == null');
  244.         collection_node._first_disp_msg = null;    
  245.         collection_node._empty = true;
  246.         }
  247.         else
  248.         {
  249.         var AdditionalAttributes = msgs.Method0Own('M_GetAdditionalAttributeMap');
  250.         var first_message = msgs.GetFirst();
  251.         if(first_message == null)
  252.             {
  253.             collection_node._empty = true;
  254.             AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
  255.             collection_node._first_disp_msg = null;
  256.             }
  257.             else
  258.             {
  259.             collection_node._first_disp_msg = first_message.objID;
  260.             collection_node._first_disp_msg_evenness = 1;
  261.             first_message.SetM(CollectionID, 1); //MM_FlagNotifyScript to 1
  262.             collection_node._empty = false;
  263.             AdditionalAttributes.SetM('MM_FlagNotifyScript', NotifyFlag);
  264.             }
  265.         } 
  266.     this.root._childrencount++;
  267.     this.root._children[CollectionID]=collection_node;
  268.     return collection_node; 
  269.   };
  270.  
  271. this.add_message_node=function(CollectionID,MsgID)      // adds node
  272.       {
  273.     if(this._collections[CollectionID] != null)
  274.         {
  275.         var collection = this.root._children[CollectionID];
  276.         var msgs = this._collections[CollectionID].obj;
  277.         }
  278.         else
  279.         {
  280.         return;
  281.         }
  282. //    msgs = external.ObjByID(CollectionID);
  283.     if(msgs == null) alert('msgs == null');
  284.     var AdditionalAttributes = msgs.Method0Own('M_GetAdditionalAttributeMap');    
  285.     var CollectionChildrenCount = msgs.Method0('M_GetCount');
  286.     if(collection._empty == true) 
  287.         {
  288.         collection._empty = false; 
  289.         collection._first_disp_msg = msgs.GetFirst().objID; 
  290.         collection._first_disp_msg_evenness = 1;
  291.         msgs.ObjByID(collection._first_disp_msg).SetM(CollectionID, 1);    //MM_FlagNotifyScript to 1
  292.         G_Associations[AssociationID].TreeView.redraw_collection(CollectionID);
  293.         return;
  294.         }
  295.        if(collection._expanded == 1)
  296.         {
  297.         var collection_container_element = document.getElementById('Association_'+this._associationID).all[CollectionID+'_container'];
  298.         var list_length = collection_container_element.children.length;
  299.         if((msgs.GetPrev(msgs.GetLast()).objID) == (collection_container_element.children(list_length-1).id))
  300.             {
  301.             if (list_length<C_MESSAGES_ON_PAGE)
  302.                 {
  303.                 var new_message_element = document.createElement('tbody');
  304.                 collection_container_element.appendChild(new_message_element);
  305.                 BuildMessageAsObject(new_message_element, CollectionID, MsgID, (collection._first_disp_msg_evenness+list_length)%2); 
  306. //                alert("collection._first_disp_msg_evenness = "+collection._first_disp_msg_evenness+"\nlist_length = "+list_length);
  307.                 }
  308.                 else
  309.                 {
  310.                 RefreshMsgScrollers(document.getElementById('Association_'+this._associationID), "next", true, CollectionID, true);
  311.                 RefreshMsgScrollers(document.getElementById('Association_'+this._associationID), "prev", false, CollectionID, true);    //!! Debug line
  312.                 AdditionalAttributes.SetM('MM_FlagNotifyScript', false);
  313.                 }
  314.             }
  315.         }
  316.     };
  317.   
  318.  
  319.   this.click=function(CollectionID)                     // expands or collaps node
  320.   {
  321.     if(this.root._children[CollectionID]._expanded == 1)
  322.         {
  323.         var collection_container = document.getElementById('Association_'+this._associationID).all[CollectionID+'_container']; 
  324.          var msgs = this._collections[CollectionID].obj;
  325. //         msgs = external.ObjByID(CollectionID);
  326.          var list_length = collection_container.children.length;
  327.          for(i=1; i<list_length; i++)
  328.             {
  329.             msgs.ObjByID(collection_container.children(i).id).SetM(CollectionID, null);    //MM_FlagNotifyScript to null
  330.             }
  331.         }
  332.     this.root._children[CollectionID]._expanded=1-this.root._children[CollectionID]._expanded;
  333.     this.redraw_collection(CollectionID);
  334.   }; 
  335.   
  336.   return this;
  337. };  // CreateTree() ends
  338.  
  339. function Body_onload() 
  340.     {
  341.     ApplicationName.innerText = external.GetAppName();
  342.     BannerSlogan.innerText = external.LS("banner_slogan");
  343.     VersionInBanner.innerHTML = 'ver. '+external.GetAppVersionUserStr();
  344.     C_AssociationTemplate = AssociationTemplate.innerHTML;
  345.     LoadProfile();
  346.     ActivateAssociation(G_ActiveAssociationID);
  347.     ExtUpdateButtons(G_ActiveAssociationID);
  348.     CountersRefreshAtTimes();
  349.     }
  350.  
  351. function LoadProfile()
  352.     {
  353.     var profile = external.Method0Own('M_GetProfile'); 
  354.     if(profile == null)
  355.         {
  356.         G_ProfileExist = false;
  357.         return false;
  358.         }
  359.     G_ProfileExist = true;
  360.     var AssociationObj = profile.GetFirst();
  361. //    G_FirstAssociationID = AssociationObj.objID;
  362.     var Associations_exist = false;
  363.     if(AssociationObj == null)
  364.         {
  365.         return false;
  366.         }
  367.     var FirstAssociationID = AssociationObj.objID;    
  368.     var ActiveAssociation_exist = false;
  369.     while(AssociationObj != null)
  370.         {
  371.         if(G_ActiveAssociationID == AssociationObj.objID)
  372.             {
  373.             ActiveAssociation_exist = true;
  374.             }
  375.         AddAssociation(AssociationObj);
  376.         var AssociationObj = profile.GetNext(AssociationObj);
  377.         }
  378. /*    if(ActiveAssociation_exist == true)
  379.         {
  380.         ActivateAssociation(G_ActiveAssociationID);
  381.         }
  382.         else
  383.         {
  384.         ActivateAssociation(FirstAssociationID);
  385.         }    */
  386.     if(ActiveAssociation_exist != true)
  387.         {
  388.         G_ActiveAssociationID = FirstAssociationID;
  389.         }    
  390. //    ExtUpdateButtons(G_ActiveAssociationID);
  391.     return true;
  392.     }
  393.  
  394. function InitAssociation(AssociationObj)                                // initialisation of association
  395.     {
  396.     AssociationID = AssociationObj.objID;
  397.     G_Associations[AssociationID]={};
  398.     G_Associations[AssociationID].self=AssociationID;
  399.     G_Associations[AssociationID].Folders_is_ready = false;
  400.     G_Associations[AssociationID].Folder_1_is_ready = false;
  401.     G_Associations[AssociationID].Folder_2_is_ready = false;
  402.     G_Associations[AssociationID].OnAssociationChangedCalled = false;
  403.     G_Associations[AssociationID].TreeView = new CreateTree(AssociationID, "tree","TreeView_element");
  404.     G_Associations[AssociationID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssociationID,'MM_SyncItemsAll'),'All',external.LS('MM_SyncItemsAll'),0);
  405.       G_Associations[AssociationID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssociationID,'USIS_SyncItemUnchanged'),'Unchanged',external.LS('USIS_SyncItemUnchanged'),0);
  406.      G_Associations[AssociationID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssociationID,'USIS_SyncItemChanged'),'Changed',external.LS('USIS_SyncItemChanged'),0);
  407.       G_Associations[AssociationID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssociationID,'USIS_SyncItemNew'),'New',external.LS('USIS_SyncItemNew'),0);
  408.       G_Associations[AssociationID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssociationID,'USIS_SyncItemDeleted'),'Deleted',external.LS('USIS_SyncItemDeleted'),0);
  409.       G_Associations[AssociationID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssociationID,'MM_UserMessagesInfo'),'Info',external.LS('MM_UserMessagesInfo'),0);
  410.       G_Associations[AssociationID].TreeView.add_collection_node(external.CreateUserMessageCollection(AssociationID,'MM_UserMessagesImportant'),'Important',external.LS('MM_UserMessagesImportant'),1);
  411.     AssociationElement = document.getElementById('Association_'+AssociationID);
  412.     AssociationElement.all['B_ANALYZE'].innerText = external.LS("button_analyze");
  413.     AssociationElement.all['B_ANALYZE'].title = external.LS("tooltip_Analyze_button");
  414.       AssociationElement.all['B_ANALYZE'].association_id = AssociationID;
  415.     AssociationElement.all['B_SYNC'].innerText = external.LS("button_synchronize");
  416.     AssociationElement.all['B_SYNC'].title = external.LS("tooltip_Sinchronize_button");
  417.     AssociationElement.all['B_SYNC'].association_id = AssociationID;
  418.     AssociationElement.all['B_STOP'].innerText = external.LS("button_stop");
  419.       AssociationElement.all['B_STOP'].title = external.LS("tooltip_Stop_button");
  420.     AssociationElement.all['B_STOP'].association_id = AssociationID;
  421.     AssociationElement.all['Important_warning_text'].innerText = external.LS("important_warning");
  422.       AssociationElement.all['Important_warning'].title = external.LS("tooltip_Important_warning");
  423.     }
  424.  
  425. function NewAssociation()
  426.     {
  427.     DeactivateAssociation(G_ActiveAssociationID);
  428.     solution = external.method0Own('M_GetSynchronizeProfileSolution');
  429.     Flag_can_reload_profile = false;
  430.     AssociationObj = solution.Method0('45001B2B2FE9B7A6F08366C1C15921A2');    //M_CreateAssociationW2Trees
  431. //    AssociationObj.Method1('45AB23FF99C4F08EFCD8EF9AFF1371B3', 'Association #'+G_LastAssociationNumber++);    //M_SetAssociationName
  432.     Flag_can_reload_profile = true;
  433.     AddAssociation(AssociationObj);
  434.     ActivateAssociation(AssociationObj.objID);     
  435. //--- Other variant -------------
  436. /*    solution = external.method0Own('M_GetSynchronizeProfileSolution');
  437.     AssociationObj = solution.Method0('45001B2B2FE9B7A6F08366C1C15921A2');    //M_CreateAssociationW2Trees
  438.     RemoveAllAssociationsFromScreen();
  439.     G_ActiveAssociationID = AssociationObj.objID;
  440.     LoadProfile();    */
  441. //    ActivateAssociation(AssociationObj.objID);
  442.     
  443.     }
  444.  
  445. function AddAssociation(AssociationObj)
  446.     {
  447.     if(TabsLabels.cells.length == 1)
  448.         {
  449.         LeftSeparatorCell = TabsLabels.insertCell(0);
  450.         LeftSeparatorCell.innerHTML = '<img src="Pics/TabCaptionPart3.gif">';
  451.         }
  452.         else
  453.         {
  454.         LeftSeparatorCell = TabsLabels.cells(TabsLabels.cells.length-2);
  455.         LeftSeparatorCell.children[0].src = 'Pics/TabCaptionPart7.gif';
  456.         }
  457.     NewLabelCell = TabsLabels.insertCell(TabsLabels.cells.length-1);
  458.     NewLabelCell.id = 'Label_'+AssociationObj.objID;
  459.     NewLabelCell.style.backgroundImage = "url('Pics/TabCaptionMid1.gif')";
  460.     NewLabelCell.style.cursor = "hand";
  461.     NewLabelCell.noWrap = true;
  462.     NewLabelCell.innerHTML = AssociationObj.Method0('443EF11F46C9207C2C595B7B21499882');    //M_GetAssociationName 
  463.     NewLabelCell.onmousedown = TabLabelOnClick;
  464.     RightSeparatorCell = TabsLabels.insertCell(TabsLabels.cells.length-1);
  465.     RightSeparatorCell.innerHTML = '<img src="Pics/TabCaptionPart4.gif">';
  466.     TabsCaptionResized();
  467.     NewAssociationElement = document.createElement('div');
  468.     AssociationsContainer.appendChild(NewAssociationElement);
  469.     NewAssociationElement.outerHTML = '<div id="Association_'+AssociationObj.objID+'" style="position:absolute; width:100%; height:100%; visibility:hidden;">'+C_AssociationTemplate+'</div>';    //AssociationTemplate.innerHTML
  470. //    document.getElementById('Association_'+AssociationObj.objID).all['Id_of_current_association'].innerText = AssociationObj.objID;
  471.     InitAssociation(AssociationObj);
  472.     G_Associations[AssociationObj.objID].TreeView.redraw();
  473.     LoadAssociationPaths(AssociationObj.objID);    // for DU: you can see many associations on the screen if comment this line
  474.     }
  475.  
  476. function ExtRemoveAssociation()
  477.     {
  478.     RemoveAssociation(G_ActiveAssociationID);
  479.     }
  480.  
  481. function RemoveAssociation(AssociationID)
  482.     {
  483.     var AssociationElement = document.getElementById('Association_'+AssociationID);
  484.     var AssociationsQuantity = (TabsLabels.cells.length-2)/2;
  485.     var LabelCell = TabsLabels.cells['Label_'+AssociationID];
  486.     var LabelCellIndex = LabelCell.cellIndex;
  487.     var LeftSeparatorCell = TabsLabels.cells(LabelCellIndex-1);
  488.     var RightSeparatorCell = TabsLabels.cells(LabelCellIndex+1);
  489.     var LastLabelIndex = TabsLabels.cells.length - 3;
  490.     var FirstLabelIndex = 1;
  491.     if(AssociationsQuantity > 1)
  492.         {
  493.         if(AssociationID == G_ActiveAssociationID)
  494.             {
  495.             DeactivateAssociation(G_ActiveAssociationID);
  496.             if(LabelCellIndex > FirstLabelIndex)
  497.                 {
  498.                 G_ActiveAssociationID = TabsLabels.cells(LabelCellIndex-2).id.replace(/Label_/,"");
  499.                 }
  500.                 else
  501.                 {
  502.                 G_ActiveAssociationID = TabsLabels.cells(LabelCellIndex+2).id.replace(/Label_/,"");
  503.                 }
  504.             ActivateAssociation(G_ActiveAssociationID);
  505.             }
  506.         if((LabelCellIndex > FirstLabelIndex)&&(LabelCellIndex < LastLabelIndex))
  507.             {
  508.             var PrevAssociationID = TabsLabels.cells(LabelCellIndex-2).id.replace(/Label_/,"");
  509.             var NextAssociationID = TabsLabels.cells(LabelCellIndex+2).id.replace(/Label_/,"");
  510.             if(PrevAssociationID == G_ActiveAssociationID)
  511.                 {
  512.                 var SeparatorSrc = 'Pics/TabCaptionPart6.gif'; //    Active/Unactive
  513.                 }
  514.                 else if(NextAssociationID == G_ActiveAssociationID)
  515.                 {
  516.                 var SeparatorSrc = 'Pics/TabCaptionPart5.gif';    //    Unactive/Active
  517.                 }
  518.                 else
  519.                 {
  520.                 var SeparatorSrc = 'Pics/TabCaptionPart7.gif';    //    Unactive/Unactive
  521.                 }
  522.             }
  523.             else if(LabelCellIndex == FirstLabelIndex)
  524.             {
  525.             var NextAssociationID = TabsLabels.cells(LabelCellIndex+2).id.replace(/Label_/,"");
  526.             if(NextAssociationID == G_ActiveAssociationID)
  527.                 {
  528.                 var SeparatorSrc = 'Pics/TabCaptionPart1.gif';    //    Empty/Active
  529.                 }
  530.                 else
  531.                 {
  532.                 var SeparatorSrc = 'Pics/TabCaptionPart3.gif';    //    Empty/Unactive
  533.                 }
  534.             }
  535.             else if(LabelCellIndex == LastLabelIndex)
  536.             {
  537.             var PrevAssociationID = TabsLabels.cells(LabelCellIndex-2).id.replace(/Label_/,"");
  538.             if(PrevAssociationID == G_ActiveAssociationID)
  539.                 {
  540.                 var SeparatorSrc = 'Pics/TabCaptionPart2.gif'; //    Active/Empty
  541.                 }
  542.                 else
  543.                 {
  544.                 var SeparatorSrc = 'Pics/TabCaptionPart4.gif';    //    Unactive/Empty
  545.                 }
  546.             }
  547.         G_Associations[AssociationID] = null;
  548.         AssociationElement.removeNode(true);
  549.         TabsLabels.deleteCell(RightSeparatorCell.cellIndex);
  550.         TabsLabels.deleteCell(LabelCell.cellIndex);
  551.         LeftSeparatorCell.children(0).src = SeparatorSrc;
  552.         }
  553.         else    // AssociationsQuantaty == 1
  554.         {
  555.         G_ActiveAssociationID = '';
  556.         G_Associations[AssociationID] = null;
  557.         AssociationElement.removeNode(true);
  558.         TabsLabels.deleteCell(RightSeparatorCell.cellIndex);
  559.         TabsLabels.deleteCell(LabelCell.cellIndex);
  560.         TabsLabels.deleteCell(LeftSeparatorCell.cellIndex);
  561.         }
  562.     TabsCaptionResized();
  563.     var AssociationObj = external.ObjByID(AssociationID);
  564.     var solution = external.method0Own('M_GetSynchronizeProfileSolution');
  565.     Flag_can_reload_profile = false;
  566.     solution.Method1('4462E413C9DCF8C259E8CA444BE8B2A7', AssociationObj);    //M_RemoveProfileAssociation
  567.     Flag_can_reload_profile = true;
  568.     }
  569.  
  570. function RemoveAllAssociationsFromScreen()
  571.     {
  572. //    DeactivateAssociation(G_ActiveAssociationID);
  573.     var AssociationQuantity = AssociationsContainer.children.length;
  574. /*    if(G_ActiveAssociationID != '')
  575.         {
  576.         DeactivateAssociation(G_ActiveAssociationID);
  577.         }    */    //Does not work correctly with {AssociationElement.removeNode(true)} in IE 5.01        
  578.     for(var i=0; i<AssociationQuantity; i++)
  579.         {
  580.         var AssociationElement = AssociationsContainer.children(0);
  581.         var AssociationID = AssociationElement.id.replace(/Association_/,"");
  582. //        G_Associations[AssociationID] = null;
  583.         delete G_Associations[AssociationID]; 
  584.         AssociationElement.removeNode(true);
  585.         var LeftSeparatorCell = TabsLabels.cells(0);
  586.         var LabelCell = TabsLabels.cells(1);
  587.         TabsLabels.deleteCell(LeftSeparatorCell.cellIndex);
  588.         TabsLabels.deleteCell(LabelCell.cellIndex);
  589.         }
  590.     if(AssociationQuantity > 0)
  591.         {
  592.         var LastSeparatorCell = TabsLabels.cells(0);
  593.         TabsLabels.deleteCell(LastSeparatorCell.cellIndex);
  594.         }
  595.     TabsCaptionResized();
  596.     }
  597.  
  598. function DeactivateAssociation(AssociationID)
  599.     {
  600. //    ExtCloseHint(AssociationID, "Syncpath_hint_1");
  601. //    ExtCloseHint(AssociationID, "Syncpath_hint_2");
  602.     var AssociationElement = document.getElementById('Association_'+AssociationID);
  603.     if(AssociationElement == null)
  604.         {
  605.         return;
  606.         }
  607.     AssociationElement.style.visibility = 'hidden';
  608.     var LastLabelIndex = TabsLabels.cells.length - 3;
  609.     var FirstLabelIndex = 1;
  610.     var LabelCell = TabsLabels.cells['Label_'+AssociationID];
  611.     var LabelCellIndex = LabelCell.cellIndex;
  612.     var LeftSeparatorCell = TabsLabels.cells(LabelCellIndex-1);
  613.     var RightSeparatorCell = TabsLabels.cells(LabelCellIndex+1);
  614.     LabelCell.style.backgroundImage = "url('Pics/TabCaptionMid1.gif')";
  615.     if(LabelCellIndex != FirstLabelIndex)
  616.         {
  617.         LeftSeparatorCell.children(0).src = 'Pics/TabCaptionPart7.gif';    // Unactive/Unactive
  618.         }
  619.         else
  620.         {
  621.         LeftSeparatorCell.children(0).src = 'Pics/TabCaptionPart3.gif';    //    Empty/Unactive
  622.         }
  623.     if(LabelCellIndex != LastLabelIndex)
  624.         {
  625.         RightSeparatorCell.children(0).src = 'Pics/TabCaptionPart7.gif';    // Unactive/Unactive
  626.         }
  627.         else
  628.         {
  629.         RightSeparatorCell.children(0).src = 'Pics/TabCaptionPart4.gif';    //    Unactive/Empty
  630.         }
  631.     }
  632.  
  633. function ActivateAssociation(AssociationID)
  634.     {
  635.     var AssociationElement = document.getElementById('Association_'+AssociationID);
  636.     if(AssociationElement == null)
  637.         {
  638.         return;
  639.         }
  640.     AssociationElement.style.visibility = 'visible';
  641.     var LastLabelIndex = TabsLabels.cells.length - 3;
  642.     var FirstLabelIndex = 1;
  643.     var LabelCell = TabsLabels.cells['Label_'+AssociationID];
  644.     var LabelCellIndex = LabelCell.cellIndex;
  645.     var LeftSeparatorCell = TabsLabels.cells(LabelCellIndex-1);
  646.     var RightSeparatorCell = TabsLabels.cells(LabelCellIndex+1);
  647.     LabelCell.style.backgroundImage = "url('Pics/TabCaptionMid2.gif')";
  648.     if(LabelCellIndex != FirstLabelIndex)
  649.         {
  650.         LeftSeparatorCell.children(0).src = 'Pics/TabCaptionPart5.gif';    // Unactive/Active
  651.         }
  652.         else
  653.         {
  654.         LeftSeparatorCell.children(0).src = 'Pics/TabCaptionPart1.gif';    //    Empty/Active
  655.         }
  656.     if(LabelCellIndex != LastLabelIndex)
  657.         {
  658.         RightSeparatorCell.children(0).src = 'Pics/TabCaptionPart6.gif';    // Active/Unactive
  659.         }
  660.         else
  661.         {
  662.         RightSeparatorCell.children(0).src = 'Pics/TabCaptionPart2.gif';    //    Active/Empty
  663.         }
  664.     G_ActiveAssociationID = AssociationID;
  665.     ScrollTabLabelIntoView(AssociationID);
  666.     LoadAssociationPaths(AssociationID);
  667.     ExtUpdateButtons(AssociationID);
  668.     }
  669.  
  670. function ExtOnAssociationChanged(AssociationID)
  671.     {
  672.     if(Flag_can_reload_profile == false)
  673.         {
  674.         return;
  675.         }
  676.     var AssociationObj = external.ObjByID(AssociationID);
  677.     var LabelCell = TabsLabels.cells['Label_'+AssociationID];
  678.     LabelCell.innerText = AssociationObj.Method0('443EF11F46C9207C2C595B7B21499882');    //M_GetAssociationName;
  679.     G_Associations[AssociationID].OnAssociationChangedCalled = true;
  680.     if(LoadAssociationPaths(AssociationID) == true)
  681.         {
  682.         if(G_AnalyzeHintCallCounter > 0)
  683.             {
  684.             ExtGiveHint(AssociationID, "Analyze_hint");
  685.             G_AnalyzeHintCallCounter--;
  686.             }
  687.         if(AssociationID == G_ActiveAssociationID)
  688.             {
  689.             setTimeout("FocusToAnalyze('"+AssociationID+"')", 0);
  690.             }
  691.         }
  692.     }
  693.  
  694. function FocusToAnalyze(AssociationID)
  695.     {
  696.     if(AssociationID != G_ActiveAssociationID)
  697.         {
  698.         return;
  699.         }
  700.     AssociationElement = document.getElementById('Association_'+AssociationID);
  701.     AnalyzeButtonElement = AssociationElement.all['B_ANALYZE'];
  702.     if(AnalyzeButtonElement.disabled == false)
  703.         {
  704.         AnalyzeButtonElement.focus();
  705.         }
  706.     }
  707.  
  708. function FocusToSyncpath(AssociationID, num)
  709.     {
  710.     if(AssociationID != G_ActiveAssociationID)
  711.         {
  712.         return;
  713.         }
  714.     AssociationElement = document.getElementById('Association_'+AssociationID);
  715.     TreePathDiv = AssociationElement.all["TreePath"+num];
  716.     if(TreePathDiv.disabled == false)
  717.         {
  718.         ExtGiveHint(AssociationID, "Syncpath_hint_"+num);
  719.         TreePathDiv.children(0).focus();
  720.         }
  721.     }
  722.  
  723.  
  724. function LoadAssociationPaths(AssociationID)
  725.     {
  726.     AssociationObj = external.ObjByID(AssociationID);
  727.     SyncTreeList = AssociationObj.GetM('CLASS_CSyncTree');
  728.     SyncTree1_Obj = SyncTreeList.GetFirst();
  729.     SyncTree2_Obj = SyncTreeList.GetNext(SyncTree1_Obj);
  730.     HintCalledNumber = "";
  731.     if(BuildFolderPanel(document.getElementById('Association_'+AssociationID).all['SyncTree2'], SyncTree2_Obj, 2) == false)
  732.         {
  733.         HintCalledNumber = "2";
  734.         G_Associations[AssociationID].Folder_2_is_ready = false;
  735.         }
  736.         else
  737.         {
  738.         G_Associations[AssociationID].Folder_2_is_ready = true;
  739.         }
  740.     if(BuildFolderPanel(document.getElementById('Association_'+AssociationID).all['SyncTree1'], SyncTree1_Obj, 1) == false)
  741.         {
  742.         HintCalledNumber = "1";
  743.         G_Associations[AssociationID].Folder_1_is_ready = false;
  744.         }
  745.         else
  746.         {
  747.         G_Associations[AssociationID].Folder_1_is_ready = true;
  748.         }
  749.     if(HintCalledNumber != "")
  750.         {
  751.         G_Associations[AssociationID].Folders_is_ready = false;
  752.         setTimeout("FocusToSyncpath('"+AssociationID+"', '"+HintCalledNumber+"')", 0);
  753.         return 0;
  754.         }
  755.     G_Associations[AssociationID].Folders_is_ready = true;
  756.     return true;
  757.     }
  758.  
  759. function BuildFolderPanel(SyncTreeElement, SyncTreeObject, FolderNum)    //    Returns true if tree is ready and false otherwise
  760.     {
  761.     SyncTreeElement.synctree_id=SyncTreeObject.objID;
  762.     if(SyncTreeObject.Method0('M_IsTreeReady') == 1)
  763.         {
  764.         SyncTree_path = SyncTreeObject.Method0Own('M_CreateTreeRootPath').Method0Own('M_ToFilename'); 
  765.         if_empty_flag = "false";
  766.         IfTreeReady = true;
  767.         }
  768.         else
  769.         {
  770.         SyncTree_path ="";
  771.         if_empty_flag = "true";
  772.         IfTreeReady = false;
  773.         }
  774.     SyncTreeElement.innerHTML = '<form id="TreeForm'+FolderNum+'" onSubmit="return ChangeSyncTree('+FolderNum+');" style="margin:0px;" title="'+external.LS("tooltip_sync_board_right")+'"  ondeactivate="Deactivate_form('+FolderNum+')" is_changed="false" is_empty="'+if_empty_flag+'">'+
  775.                             '<table width="100%" cellspacing="0"><tr><td colspan="3" width="100%" height="22px;"><div style="position:relative; top:0px; left:0px; height:22px;">'+
  776.                                 '<div id="TreePath'+FolderNum+'" style="position:absolute; top:0px; left:0px; width:296px; height:25px;">'+
  777.                 '<input id="'+SyncTreeObject.objID+'_path" type="text" value="'+SyncTree_path+'" style="width:100%; border: solid 1px black; background:#f6f6f6; font-family:tahoma; font-size:10pt;" onkeyup="Ok_Activate('+FolderNum+')" onactivate="Activate_form('+FolderNum+')"></div></div>'+    
  778.                     '</td></tr><tr><td nowrap>'+
  779.                  '<input name="TreeOpen'+FolderNum+'" type="button"  value="'+external.LS("button_open")+'" onclick=OpenSyncTree('+FolderNum+') style="width:60px; font-size:10px; " title="'+external.LS("tooltip_FSP_Open")+'">'+
  780.                 '<input name="TreeBrowse'+FolderNum+'" type="button"  value="'+external.LS("button_browse")+'" onclick=BrowseSyncTree('+FolderNum+') style="width:60px; font-size:10px; " title="'+external.LS("tooltip_FSP_Browse")+'">'+
  781.                    '</td><td width="100%"></td><td id="TreeSubmitButtons'+FolderNum+'" nowrap>'+
  782.                 '<input name="TreeOk'+FolderNum+'" type="submit"  value="'+external.LS("button_ok")+'" style="width:60px; font-size:10px; " disabled tabIndex="0" title="'+external.LS("tooltip_FSP_Ok")+'">'+
  783.                  '<input name="TreeCancel'+FolderNum+'" type="button"  value="'+external.LS("button_cancel")+'" onclick=CancelSyncTree('+FolderNum+') style="width:60px;  font-size:10px;" disabled tabIndex="0" title="'+external.LS("tooltip_FSP_Cancel")+'">'+
  784.                     '</td></tr></table>'+
  785.                 '</form>';
  786.     return IfTreeReady;
  787.     }
  788.  
  789. function OnCollectionExpandIconClick(AssociationID, CollectionID)
  790.     {
  791.     G_Associations[AssociationID].TreeView.click(CollectionID);
  792.     }
  793.  
  794. function go_prev_page(CollectionID)           
  795. {
  796.     control_element = window.event.srcElement;
  797.     ScrollControlDown(control_element);
  798.     AssociationElement = document.getElementById('Association_'+G_ActiveAssociationID);
  799.     collection_container = AssociationElement.all[CollectionID+'_container']; 
  800.      if(collection_container == null)
  801.         {
  802.         return;
  803.         }    
  804.     msgs = G_Associations[G_ActiveAssociationID].TreeView._collections[CollectionID].obj;
  805.     list_length = collection_container.children.length;
  806.     if(msgs.GetFirst().objID == G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg)
  807.          {
  808.         RefreshMsgScrollers(AssociationElement, "prev", false, CollectionID, true);
  809.         return;
  810.         }
  811.      for(i=0; i<list_length; i++)
  812.         {
  813.         msgs.ObjByID(collection_container.children(i).id).SetM(CollectionID, null);    //MM_FlagNotifyScript to null
  814.         }
  815.     msg = msgs.ObjByID(G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg); 
  816.     i=C_MESSAGES_ON_PAGE;    //G_Associations[AssociationID].TreeView._messagesonpage;
  817.     MsgEvenness = G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness;
  818.     while((i>0)&&(msg.objID != msgs.GetFirst().objID))
  819.         {
  820.         MsgEvenness = 1 - MsgEvenness;
  821.         i--;
  822.         msg = msgs.GetPrev(msg);
  823.         }
  824.     G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg = msg.objID;
  825.     G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = MsgEvenness;
  826.     G_Associations[G_ActiveAssociationID].TreeView.redraw_collection(CollectionID);   
  827. }
  828.  
  829. function go_next_page(CollectionID)           
  830. {
  831.     control_element = window.event.srcElement;
  832.     ScrollControlDown(control_element);
  833.     AssociationElement = document.getElementById('Association_'+G_ActiveAssociationID);
  834.     collection_container = AssociationElement.all[CollectionID+'_container']; 
  835.      if(collection_container == null)
  836.         {
  837.         return;
  838.         }    
  839.     msgs = G_Associations[G_ActiveAssociationID].TreeView._collections[CollectionID].obj;
  840.      list_length = collection_container.children.length;
  841.     last_in_list = collection_container.children(list_length-1);
  842.     if(msgs.GetLast().objID == last_in_list.id)
  843.          {
  844.         if(msgs.GetFirst().objID == collection_container.children(0).id)
  845.             {
  846.             var MsgScrollersExist = false;
  847.             RefreshMsgScrollers(AssociationElement, "next", false, CollectionID, MsgScrollersExist);
  848.             RefreshMsgScrollers(AssociationElement, "prev", false, CollectionID, MsgScrollersExist);
  849.             }
  850.             else
  851.             {
  852.             var MsgScrollersExist = true;
  853.             RefreshMsgScrollers(AssociationElement, "next", false, CollectionID, MsgScrollersExist);
  854.             }
  855.         AdditionalAttributes = msgs.Method0Own('M_GetAdditionalAttributeMap');
  856.         AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
  857.         return;
  858.         }
  859.      for(i=0; i<list_length; i++)
  860.         {
  861.         msgs.ObjByID(collection_container.children(i).id).SetM(CollectionID, null);    //MM_FlagNotifyScript to null
  862.         }
  863.     
  864.     var msg = msgs.GetNext(msgs.ObjByID(last_in_list.id)); 
  865.     var i = C_MESSAGES_ON_PAGE;
  866.     while((i>0)&&(msg.objID != msgs.GetLast().objID))
  867.         {
  868.         i--;
  869.         msg = msgs.GetNext(msg);
  870.         }
  871.     if(i > 0)
  872.         {
  873.         go_last_page(CollectionID);
  874.         }
  875.         else
  876.         {
  877.         G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg = msgs.GetNext(msgs.ObjByID(last_in_list.id)).objID;
  878.         MsgEvenness = G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness;
  879.         G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = (MsgEvenness+list_length)%2;
  880.         G_Associations[G_ActiveAssociationID].TreeView.redraw_collection(CollectionID); 
  881.         }
  882. }
  883.  
  884. function go_next_message(CollectionID)           
  885. {
  886.     control_element = window.event.srcElement;
  887.     ScrollControlDown(control_element);
  888.     var AssociationElement = document.getElementById('Association_'+G_ActiveAssociationID);
  889.     var collection_container = AssociationElement.all[CollectionID+'_container']; 
  890.      if(collection_container == null)
  891.         {
  892.         return;
  893.         }    
  894.     var msgs = G_Associations[G_ActiveAssociationID].TreeView._collections[CollectionID].obj;
  895.      var list_length = collection_container.children.length;
  896.     var last_in_list = collection_container.children(list_length-1);
  897.     var AdditionalAttributes = msgs.Method0Own('M_GetAdditionalAttributeMap');
  898.     if(msgs.GetLast().objID == last_in_list.id)
  899.          {
  900. //        var collection_next = AssociationElement.all[CollectionID+'_next'];
  901. //        collection_next.innerHTML = CreateScrollControls("next", false, CollectionID);
  902.         RefreshMsgScrollers(AssociationElement, "next", false, CollectionID, true);
  903.         AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
  904.         return;
  905.         }
  906.     var first_in_list = collection_container.children(0);
  907.      msgs.ObjByID(first_in_list.id).SetM(CollectionID, null);    //MM_FlagNotifyScript to null
  908.     //G_Associations[AssociationID].TreeView.root._children[CollectionID]._first_disp_msg = collection_container.children(1).id;
  909.     var new_on_page_last_msg_id = msgs.GetNext(msgs.ObjByID(last_in_list.id)).objID;
  910.     first_in_list.removeNode(true); // Delete the element and all it's children
  911.     
  912.     G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg = collection_container.children(0).id;
  913.     MsgEvenness = G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness;
  914.     G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = 1 - MsgEvenness;
  915.     var new_last_message_element = document.createElement('tbody');
  916.     collection_container.appendChild(new_last_message_element);
  917.     BuildMessageAsObject(new_last_message_element, CollectionID, new_on_page_last_msg_id, (MsgEvenness+list_length)%2); 
  918.  
  919.     
  920.     if(new_on_page_last_msg_id == msgs.GetLast().objID)    //New message on page is last in collection, then remove "Next" control
  921.             {
  922.             AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
  923. //            var collection_next = AssociationElement.all[CollectionID+'_next'];
  924. //            collection_next.innerHTML = CreateScrollControls("next", false, CollectionID);
  925.             RefreshMsgScrollers(AssociationElement, "next", false, CollectionID, true);
  926.             }
  927. //    var collection_prev = AssociationElement.all[CollectionID+'_prev'];
  928. //    collection_prev.innerHTML = CreateScrollControls("prev", true, CollectionID);
  929.     RefreshMsgScrollers(AssociationElement, "prev", true, CollectionID, true);
  930. }
  931.  
  932. function go_prev_message(CollectionID)           
  933. {
  934. //    alert('go_prev_message pressed');
  935.     control_element = window.event.srcElement;
  936.     ScrollControlDown(control_element);
  937.     AssociationElement = document.getElementById('Association_'+G_ActiveAssociationID);
  938.     collection_container = AssociationElement.all[CollectionID+'_container']; 
  939.     if(collection_container == null)
  940.         {
  941.         return;
  942.         }    
  943.     msgs = G_Associations[G_ActiveAssociationID].TreeView._collections[CollectionID].obj;
  944.     list_length = collection_container.children.length;
  945. //    alert(list_length);
  946. //    alert(msgs.GetFirst().objID+' == '+G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg);
  947.     if(msgs.GetFirst().objID == G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg)
  948.          {
  949. //        collection_prev = AssociationElement.all[CollectionID+'_prev'];
  950. //        collection_prev.innerHTML = CreateScrollControls("prev", false, CollectionID);
  951.         RefreshMsgScrollers(AssociationElement, "prev", false, CollectionID, true);
  952.         return;
  953.         }
  954.      if(list_length == C_MESSAGES_ON_PAGE) //G_Associations[AssociationID].TreeView._messagesonpage)
  955.         {
  956.         last_in_list = collection_container.children(list_length-1);
  957.         msgs.ObjByID(last_in_list.id).SetM(CollectionID, null);    //MM_FlagNotifyScript to null
  958.         
  959.         last_in_list.removeNode(true); // Delete the element and all it's children
  960.         AdditionalAttributes = msgs.Method0Own('M_GetAdditionalAttributeMap');
  961.         AdditionalAttributes.SetM('MM_FlagNotifyScript', false);
  962. //        collection_next = AssociationElement.all[CollectionID+'_next'];
  963. //        collection_next.innerHTML = CreateScrollControls("next", true, CollectionID);
  964.         RefreshMsgScrollers(AssociationElement, "next", true, CollectionID, true);
  965.         }
  966.     first_in_list = collection_container.children(0);
  967.     new_on_page_first_msg_id = msgs.GetPrev(msgs.ObjByID(first_in_list.id)).objID;
  968.     
  969.     var new_first_message_element = document.createElement('tbody');
  970.     collection_container.insertBefore(new_first_message_element, first_in_list);
  971.     var NewFirstMsgEvenness = (G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness+1)%2;
  972.     BuildMessageAsObject(new_first_message_element, CollectionID, new_on_page_first_msg_id, NewFirstMsgEvenness); 
  973.     G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness = NewFirstMsgEvenness;
  974.     G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg = collection_container.children(0).id;
  975.     if(msgs.GetFirst().objID == G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg)
  976.          {
  977. //        collection_prev = AssociationElement.all[CollectionID+'_prev'];
  978. //        collection_prev.innerHTML = CreateScrollControls("prev", false, CollectionID);
  979.         RefreshMsgScrollers(AssociationElement, "prev", false, CollectionID, true);
  980.         }
  981.     return;  
  982. }
  983.  
  984.  
  985. function go_first_page(CollectionID)
  986.     {
  987.     AssociationElement = document.getElementById('Association_'+G_ActiveAssociationID);
  988.     collection_container = AssociationElement.all[CollectionID+'_container']; 
  989.      if(collection_container == null)
  990.         {
  991.         return;
  992.         }    
  993.     msgs = G_Associations[G_ActiveAssociationID].TreeView._collections[CollectionID].obj;
  994.      list_length = collection_container.children.length;
  995.     first_msg_id = msgs.GetFirst().objID;
  996.     if(first_msg_id == G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg)
  997.          {
  998. //        collection_prev = AssociationElement.all[CollectionID+'_prev'];
  999. //        collection_prev.innerHTML = CreateScrollControls("prev", false, CollectionID);
  1000.         RefreshMsgScrollers(AssociationElement, "prev", false, CollectionID, true);
  1001.         return;
  1002.         }
  1003.     for(i=0; i<list_length; i++)
  1004.         {
  1005.         msgs.ObjByID(collection_container.children(i).id).SetM(CollectionID, null);    //MM_FlagNotifyScript to null
  1006.         }
  1007.     G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg = first_msg_id;
  1008.     G_Associations[G_ActiveAssociationID].TreeView.redraw_collection(CollectionID);   
  1009.     }
  1010.     
  1011. function go_last_page(CollectionID)
  1012.     {
  1013.     AssociationElement = document.getElementById('Association_'+G_ActiveAssociationID);
  1014.     collection_container = AssociationElement.all[CollectionID+'_container']; 
  1015.      if(collection_container == null)
  1016.         {
  1017.         return;
  1018.         }    
  1019.      msgs = G_Associations[G_ActiveAssociationID].TreeView._collections[CollectionID].obj;    
  1020.     list_length = collection_container.children.length;
  1021.     msg = msgs.GetLast();
  1022.     last_in_list = collection_container.children(list_length-1);
  1023.     if(msg.objID == last_in_list.id)
  1024.          {
  1025. //        collection_next = AssociationElement.all[CollectionID+'_next'];
  1026. //        collection_next.innerHTML = CreateScrollControls("next", false, CollectionID);
  1027.         RefreshMsgScrollers(AssociationElement, "next", false, CollectionID, true);
  1028.         AdditionalAttributes = msgs.Method0Own('M_GetAdditionalAttributeMap');
  1029.         AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
  1030.         return;
  1031.         }
  1032.     for(i=0; i<list_length; i++)
  1033.         {
  1034.         msgs.ObjByID(collection_container.children(i).id).SetM(CollectionID, null);    //MM_FlagNotifyScript to null
  1035.         }
  1036.     i=C_MESSAGES_ON_PAGE - 1;     //G_Associations[AssociationID].TreeView._messagesonpage-1;
  1037.     while((i>0)&&(msg.objID != msgs.GetFirst().objID))
  1038.         {
  1039.         i--;
  1040.         msg = msgs.GetPrev(msg);
  1041.         }
  1042.     G_Associations[G_ActiveAssociationID].TreeView.root._children[CollectionID]._first_disp_msg = msg.objID;
  1043.     G_Associations[G_ActiveAssociationID].TreeView.redraw_collection(CollectionID);   
  1044.     }
  1045.  
  1046. function CreateScrollControls(direction, if_active, CollectionID, MsgScrollersExist)
  1047.     {
  1048.     if(!MsgScrollersExist)
  1049.         {
  1050.         this.msg = '';
  1051.         this.page = '';
  1052.         this.end = '';
  1053.         
  1054.         this.top_msg = '';
  1055.         this.top_page = '';
  1056.         this.top_end = '';
  1057.         
  1058.         return this;
  1059.         }
  1060.         
  1061.     if(direction == 'next')
  1062.         {
  1063.         dir1 = 'next';
  1064.         dir2 = 'Next';
  1065.         dir3 = 'last';
  1066.         dir4 = 'Last';
  1067.         var v_border = 'border-right:solid 1px #787864;';
  1068.         }
  1069.         else
  1070.         {
  1071.         dir1 = 'prev';
  1072.         dir2 = 'Prev';
  1073.         dir3 = 'first';
  1074.         dir4 = 'First';
  1075.         var v_border = 'border-left:solid 1px #787864;';
  1076.         }
  1077.     var border_style = 'style="border-top:solid 1px #787864; border-bottom:solid 1px #787864;"';
  1078.     var border_style_brink = 'style="border-top:solid 1px #787864; border-bottom:solid 1px #787864; '+v_border+'"';
  1079.     if(if_active == true)
  1080.         {
  1081.         this.msg = '<img onmousedown="go_'+dir1+'_message(\''+CollectionID+'\');" onmouseover="ScrollControlHi()" onmouseout="ScrollControlUsual()" onmouseup="ScrollControlUp()" src="Pics/'+dir2+'Message.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir1+"_message")+'">';
  1082.         this.page = '<img onmousedown="go_'+dir1+'_page(\''+CollectionID+'\');" onmouseover="ScrollControlHi()" onmouseout="ScrollControlUsual()" src="Pics/'+dir2+'Page.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir1+"_page")+'">';
  1083.         this.end = '<img onmousedown="go_'+dir3+'_page(\''+CollectionID+'\');" onmouseover="ScrollControlHi()" onmouseout="ScrollControlUsual()" src="Pics/To'+dir4+'.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir3+"_page")+'">';
  1084.         
  1085.         this.top_msg = '<img onmousedown="go_'+dir1+'_message(\''+CollectionID+'\');" onmouseover="ScrollControlHi()" onmouseout="ScrollControlUsual()" onmouseup="ScrollControlUp()" src="Pics/'+dir2+'Message.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir1+"_message")+'" '+border_style+'>';
  1086.         this.top_page = '<img onmousedown="go_'+dir1+'_page(\''+CollectionID+'\');" onmouseover="ScrollControlHi()" onmouseout="ScrollControlUsual()" src="Pics/'+dir2+'Page.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir1+"_page")+'" '+border_style+'>';
  1087.         this.top_end = '<img onmousedown="go_'+dir3+'_page(\''+CollectionID+'\');" onmouseover="ScrollControlHi()" onmouseout="ScrollControlUsual()" src="Pics/To'+dir4+'.gif" style="cursor:hand" title="'+external.LS("tooltip_"+dir3+"_page")+'" '+border_style_brink+'>';
  1088.  
  1089.         }
  1090.         else
  1091.         {
  1092.         this.msg = '<img src="Pics/'+dir2+'Message_gray.gif" >';
  1093.         this.page = '<img src="Pics/'+dir2+'Page_gray.gif" >';
  1094.         this.end = '<img src="Pics/To'+dir4+'_gray.gif">';
  1095.         
  1096.         this.top_msg = '<img src="Pics/'+dir2+'Message_gray.gif"  '+border_style+'>';
  1097.         this.top_page = '<img src="Pics/'+dir2+'Page_gray.gif"  '+border_style+'>';
  1098.         this.top_end = '<img src="Pics/To'+dir4+'_gray.gif" '+border_style_brink+'>';
  1099.         }
  1100.     return this;
  1101.     }
  1102.  
  1103. function RefreshMsgScrollers(AssociationElement, direction, if_active, CollectionID, MsgScrollersExist)
  1104.     {
  1105.     var collection_scrollbar = AssociationElement.all[CollectionID+'_ScrollBar'];
  1106.     var collection_top_scrollbar = AssociationElement.all[CollectionID+'_in'];
  1107. //    var MsgScrollersExist = true; //Debug line
  1108.     Scroll_controls = new CreateScrollControls(direction, if_active, CollectionID, MsgScrollersExist);
  1109.     if(direction == 'next')
  1110.         {
  1111.         dir2 = 'Next';
  1112.         }
  1113.         else
  1114.         {
  1115.         dir2 = 'Prev';
  1116.         }
  1117.     collection_scrollbar.all[dir2+'_msg'].innerHTML = Scroll_controls.msg;
  1118.     collection_scrollbar.all[dir2+'_page'].innerHTML = Scroll_controls.page;
  1119.     collection_scrollbar.all[dir2+'_end'].innerHTML = Scroll_controls.end;
  1120.     collection_top_scrollbar.all['Top'+dir2+'_msg'].innerHTML = Scroll_controls.top_msg;
  1121.     collection_top_scrollbar.all['Top'+dir2+'_page'].innerHTML = Scroll_controls.top_page;
  1122.     collection_top_scrollbar.all['Top'+dir2+'_end'].innerHTML = Scroll_controls.top_end;
  1123.     }
  1124.  
  1125. function ScrollControlHi()
  1126.     {
  1127.     control_element = window.event.srcElement;
  1128.     control_src = control_element.src;
  1129.     if(control_src == null)
  1130.         {
  1131.         return;
  1132.         }
  1133.     control_element.src = control_src.replace(/.gif/,"_hi.gif");
  1134.     }
  1135.  
  1136. function ScrollControlUsual()
  1137.     {
  1138.     control_element = window.event.srcElement;
  1139.     control_src = control_element.src;
  1140.     if(control_src == null)
  1141.         {
  1142.         return;
  1143.         }
  1144.     control_element.src = control_src.replace(/(_hi)?.gif/,".gif");
  1145.     }
  1146.     
  1147. function ScrollControlUp()
  1148.     {
  1149.     control_element = window.event.srcElement;
  1150.     control_src = control_element.src;
  1151.     if(control_src == null)
  1152.         {
  1153.         return;
  1154.         }
  1155.     control_element.src = control_src.replace(/(_hi)?.gif/,"_hi.gif");
  1156.     }
  1157.     
  1158. function ScrollControlDown(control_element)
  1159.     {
  1160.     if(control_element == null)
  1161.         {
  1162. //        alert('control_element == null');
  1163.         return;
  1164.         }
  1165.     if(control_element.tagName != 'IMG')
  1166.         {
  1167. //        alert('control_element.tagName == '+control_element.tagName);
  1168.         return;
  1169.         }
  1170.     control_src = control_element.src;    // Error 1152 occurred at 1-5-2
  1171.     if(control_src == null)
  1172.         {
  1173. //        alert('control_src == null');
  1174.         return;
  1175.         }
  1176. //    alert('control_src == '+control_src);
  1177.     control_element.src = control_src.replace(/(_hi)?.gif/,".gif");
  1178.     }
  1179.  
  1180. function CountersRefreshAtTimes()
  1181.     {
  1182.     ActiveAssociationObj = external.ObjByID(G_ActiveAssociationID);
  1183.     ExtCounterRefresh(G_ActiveAssociationID, G_Associations[G_ActiveAssociationID].TreeView._collectionIdByName['All']);
  1184.     ExtCounterRefresh(G_ActiveAssociationID, G_Associations[G_ActiveAssociationID].TreeView._collectionIdByName['Unchanged']);
  1185.     ExtCounterRefresh(G_ActiveAssociationID, G_Associations[G_ActiveAssociationID].TreeView._collectionIdByName['Changed']);
  1186.     ExtCounterRefresh(G_ActiveAssociationID, G_Associations[G_ActiveAssociationID].TreeView._collectionIdByName['New']);
  1187.     ExtCounterRefresh(G_ActiveAssociationID, G_Associations[G_ActiveAssociationID].TreeView._collectionIdByName['Deleted']);
  1188.     ExtCounterRefresh(G_ActiveAssociationID, G_Associations[G_ActiveAssociationID].TreeView._collectionIdByName['Info']);
  1189.     ExtCounterRefresh(G_ActiveAssociationID, G_Associations[G_ActiveAssociationID].TreeView._collectionIdByName['Important']);
  1190.     if(G_CounterRefreshFlag == true)
  1191.         {
  1192.         window.setTimeout("CountersRefreshAtTimes()",1000);
  1193.         }
  1194.     }
  1195.  
  1196. function ExtCounterRefresh(AssociationID, CollectionID)
  1197.     {
  1198.     AssociationElement = document.getElementById('Association_'+AssociationID);
  1199.     if(AssociationElement == null)
  1200.         {
  1201.         return;
  1202.         }
  1203.     collection_caption_element = AssociationElement.all[CollectionID+'_caption'];
  1204.     if(collection_caption_element != null)
  1205.         {
  1206.         collectionObj = G_Associations[AssociationID].TreeView._collections[CollectionID].obj;    
  1207.         CollectionChildrenCount = collectionObj.Method0('M_GetCount');
  1208.         if(CollectionChildrenCount > 0)
  1209.             {
  1210.             collection_caption_element.innerHTML = CollectionChildrenCount;
  1211.             }
  1212.             else
  1213.             {
  1214.             G_Associations[AssociationID].TreeView.redraw_collection(CollectionID);
  1215.             }
  1216.         }
  1217.     }
  1218.  
  1219. function FillMsgNode(MsgObj, MsgEvenness) 
  1220.     {
  1221. //    MsgEvenness = 1;// Debug line, change later
  1222.     if(MsgEvenness == 0)
  1223.         {
  1224.         var TbodyClass = "Msg_Even";
  1225.         }
  1226.         else
  1227.         {
  1228.         var TbodyClass = "Msg_Odd";
  1229.         }
  1230.     if(MsgObj.IsSyncItemMsg())
  1231.         {
  1232.         solution = MsgObj.GetObjM('MM_Solution');
  1233.         if(solution == null) 
  1234.             {
  1235.             alert("solution == null");
  1236.             return "";
  1237.             }
  1238.         var AssociationObj = MsgObj.GetM('CLASS_CSolutionDoAssociationSync');
  1239.         var SyncTreeList = AssociationObj.GetM('CLASS_CSyncTree');
  1240.         var SyncTree1_Obj = SyncTreeList.GetFirst();
  1241.         var SyncTree2_Obj = SyncTreeList.GetNext(SyncTree1_Obj);
  1242.         var SyncTreeId_1 = SyncTree1_Obj.GetM('MM_TreeID'); 
  1243.         var SyncTreeId_2 = SyncTree2_Obj.GetM('MM_TreeID'); 
  1244.         var WinningTreeID = solution.GetM('MM_WinningTreeID'); 
  1245.         var SolutionActionState = solution.GetM('MM_ActionState'); 
  1246.         var WinningArrow = "Attention!!!";
  1247.         var MoreMarker = "X";
  1248.         var file1_name = solution.Method1ID('M_CreateFullPathStrByTreeID',SyncTreeId_1); 
  1249.         var file2_name = solution.Method1ID('M_CreateFullPathStrByTreeID',SyncTreeId_2); 
  1250.         LeftSyncItemCharacteristics = new CreateSyncItemCharacteristics(solution,SyncTreeId_1); 
  1251.         RightSyncItemCharacteristics = new CreateSyncItemCharacteristics(solution,SyncTreeId_2);
  1252.         if((SolutionActionState == null)||(SolutionActionState == C_ACTION_STATE_INIT)) //ACTION_STATE_INIT
  1253.             {
  1254.             if (WinningTreeID == SyncTreeId_1) 
  1255.                 {
  1256.                 tooltip_1 = external.LS("tooltip_copy")+' '+file1_name+' '+external.LS("tooltip_to")+' '+file2_name;
  1257.                 tooltip_2 = external.LS("tooltip_more_alt");
  1258.                 if(LeftSyncItemCharacteristics.if_missing != true)
  1259.                     {
  1260.                     WinningArrow='<img src="Pics/Arrow1.gif" title="'+tooltip_1+'">';
  1261.                     }
  1262.                     else
  1263.                     {
  1264.                     WinningArrow='<img src="Pics/Arrow1_del.gif" title="'+tooltip_1+'">';
  1265.                     }
  1266.                 MoreMarker = '<img association_id="'+AssociationObj.objID+'" parent_msg_id="'+MsgObj.objID+'" onclick=ShowAltArrows() src="Pics/More.gif" title="'+tooltip_2+'">'; //+external.LS("tooltip_more_alt")+
  1267.                 }
  1268.             else if (WinningTreeID == SyncTreeId_2) 
  1269.                 {
  1270.                 tooltip_1 = external.LS("tooltip_copy")+' '+file2_name+' '+external.LS("tooltip_to")+' '+file1_name;
  1271.                 tooltip_2 = external.LS("tooltip_more_alt");
  1272.                 if(RightSyncItemCharacteristics.if_missing != true)
  1273.                     {
  1274.                     WinningArrow='<img src="Pics/Arrow2.gif" title="'+tooltip_1+'">';
  1275.                     }
  1276.                     else
  1277.                     {
  1278.                     WinningArrow='<img src="Pics/Arrow2_del.gif" title="'+tooltip_1+'">';
  1279.                     }
  1280.                 MoreMarker = '<img association_id="'+AssociationObj.objID+'" parent_msg_id="'+MsgObj.objID+'" onclick=ShowAltArrows() src="Pics/More.gif" title="'+tooltip_2+'">';
  1281.                 }
  1282.             else if (WinningTreeID == C_CID) //CID 
  1283.                 {
  1284.                 tooltip_1 = external.LS("tooltip_CID_arrow");
  1285.                 tooltip_2 = external.LS("tooltip_more_alt");
  1286.                 WinningArrow='<img src="Pics/Arrow3.gif" title="'+tooltip_1+'">';
  1287.                 MoreMarker = '<img association_id="'+AssociationObj.objID+'" parent_msg_id="'+MsgObj.objID+'" onclick=ShowAltArrows() src="Pics/More.gif" title="'+tooltip_2+'">';
  1288.                 }
  1289.             }
  1290.         else if(SolutionActionState == C_ACTION_STATE_IN_PROGRESS) //ACTION_STATE_IN_PROGRESS
  1291.             {
  1292.             if (WinningTreeID == SyncTreeId_1) 
  1293.                 {
  1294.                 WinningArrow='<img src="Pics/Arrow1_progressed.gif" title="'+external.LS("tooltip_action_in_progress")+'">';
  1295.                 MoreMarker = '<img src="Pics/More.gif">';
  1296.                 }
  1297.             else if (WinningTreeID == SyncTreeId_2) 
  1298.                 {
  1299.                 WinningArrow='<img src="Pics/Arrow2_progressed.gif" title="'+external.LS("tooltip_action_in_progress")+'">';
  1300.                 MoreMarker = '<img src="Pics/More.gif">';
  1301.                 }
  1302.             else if (WinningTreeID == C_CID) //CID
  1303.                 {
  1304.                 tooltip_1 = external.LS("tooltip_CID_arrow");
  1305.                 WinningArrow='<img src="Pics/Arrow3.gif" title="'+tooltip_1+'">';
  1306.                 MoreMarker = '<img src="Pics/More.gif">';
  1307.                 }
  1308.             }
  1309.         else if(SolutionActionState == C_ACTION_STATE_DONE) //ACTION_STATE_DONE
  1310.             {
  1311.             if (WinningTreeID == SyncTreeId_1) 
  1312.                 {
  1313.                 tooltip_1 = external.LS("tooltip_action_done");
  1314.                 if(LeftSyncItemCharacteristics.if_missing != true)
  1315.                     {
  1316.                     WinningArrow='<img src="Pics/Arrow1_gray.gif" title="'+tooltip_1+'">';
  1317.                     }
  1318.                     else
  1319.                     {
  1320.                     WinningArrow='<img src="Pics/Arrow1_del_gray.gif" title="'+tooltip_1+'">';
  1321.                     }
  1322. //                WinningArrow='<img src="Pics/Arrow1_gray.gif" title="'+external.LS("tooltip_action_done")+'">';
  1323.                 MoreMarker = '<img src="Pics/More_ok.gif">';
  1324.                 }
  1325.             else if (WinningTreeID == SyncTreeId_2) 
  1326.                 {
  1327.                 tooltip_1 = external.LS("tooltip_action_done");
  1328.                 if(RightSyncItemCharacteristics.if_missing != true)
  1329.                     {
  1330.                     WinningArrow='<img src="Pics/Arrow2_gray.gif" title="'+tooltip_1+'">';
  1331.                     }
  1332.                     else
  1333.                     {
  1334.                     WinningArrow='<img src="Pics/Arrow2_del_gray.gif" title="'+tooltip_1+'">';
  1335.                     }
  1336. //                WinningArrow='<img src="Pics/Arrow2_gray.gif" title="'+external.LS("tooltip_action_done")+'">';
  1337.                 MoreMarker = '<img src="Pics/More_ok.gif">';
  1338.                 }
  1339.             else if (WinningTreeID == C_CID) //CID
  1340.                 {
  1341.                 WinningArrow='<img src="Pics/Arrow3_gray.gif"  title="'+external.LS("tooltip_action_done")+'">';
  1342.                 MoreMarker = '<img src="Pics/More_ok.gif">';
  1343.                 }
  1344.             }
  1345.         Severity = MsgObj.Method0('M_GetStackSeverity');
  1346.         Alternatives_Arrows = "";
  1347.         /*if((Severity >= C_ERR_QUESTION)&&((SolutionActionState == null)||(SolutionActionState == C_ACTION_STATE_INIT))) // C_ERR_QUESTION = 6000 
  1348.             {
  1349.             Alternatives_Arrows = MakeAltArrows(AssociationObj, solution);
  1350.             tooltip_2 = external.LS("tooltip_hide_alt");
  1351.             AltButtonsClass = 'AltButtonsExpanded';
  1352.             MoreMarker = '<img association_id="'+AssociationObj.objID+'" parent_msg_id="'+
  1353.                     MsgObj.objID+'" onclick=HideAltArrows() src="Pics/More_up.gif" title="'+tooltip_2+'">'; 
  1354.             }
  1355.             else*/
  1356.             {
  1357.             AltButtonsClass = 'AltButtonsCollapsed';
  1358.             Alternatives_Arrows = "";
  1359.             } 
  1360. /*--------------------------------------------------------------------------------------------        
  1361.    <tbody class="Msg_Odd">
  1362.   <tr>
  1363.     <td width="50%" class="SyncAttribute" rowspan="2">c:\tete<wbr>\ert<wbr>\oifoio<wbr>\1<wbr>\file1.txt</td>
  1364.     <td class="SyncAttribute" rowspan="2">1234</td>
  1365.     <td nowrap class="SyncAttribute" rowspan="2">13.10.2004 11:23</td>
  1366.     <td class="Arrow"><img src="Pics/Arrow1.gif"></td><td class="MoreArrow"><img src="Pics/More.gif"></td>
  1367.        <td width="50%" class="SyncAttribute" rowspan="2">c:\tete<wbr>\1<wbr>\file1.txt</td>
  1368.     <td class="SyncAttribute"  rowspan="2">1234</td>
  1369.     <td nowrap class="SyncAttribute"  rowspan="2">13.10.2004 11:23</td>
  1370.   </tr>
  1371.   <tr>
  1372.         <td class="AltButtonsExpanded" colspan="2" nowrap>
  1373.         <img src="Pics/Arrow2_small_but.gif" style="position:relative; left:1px; top:2px;"><img src="Pics/Arrow1_small_but.gif" style="position:relative; left:2px; top:2px;"><img src="Pics/Arrow3_small_but.gif" style="position:relative; left:3px; top:2px;">
  1374.          </td>
  1375.   </tr>
  1376.    </tbody>
  1377.  
  1378. */ //--------------------------------------------------------------------------------------------
  1379.         if(LeftSyncItemCharacteristics.state == '')
  1380.             {
  1381.             LeftSyncItemCharacteristics_html = '<td width="50%" class="SyncAttrName" rowspan="2">'+
  1382.                 LeftSyncItemCharacteristics.name+'</td>'+
  1383.                     '<td title="'+external.LS("tooltip_file_size")+'" class="SyncAttribute" rowspan="2">'+
  1384.                     '<span style="width:40px">'+LeftSyncItemCharacteristics.size+'</span>'+
  1385.                     '</td><td nowrap class="SyncAttribute" title="'+external.LS("tooltip_file_time")+'" rowspan="2">'+
  1386.                         '<span style="width:90px">'+LeftSyncItemCharacteristics.time+'</span></td>';
  1387.             }
  1388.             else
  1389.             {
  1390.             if(LeftSyncItemCharacteristics.if_missing == true)
  1391.                 {
  1392.                 var State_style = 'style="color:red"';
  1393.                 }
  1394.                 else
  1395.                 {
  1396.                 var State_style = '';
  1397.                 }
  1398.             LeftSyncItemCharacteristics_html = '<td width="50%" class="SyncAttrName" rowspan="2">'+
  1399.                         LeftSyncItemCharacteristics.name+'</td>'+
  1400.                     '<td class="SyncAttrState" colspan="2" valign="middle" align="center" nowrap '+State_style+' rowspan="2">'+
  1401.                         '<span style="width:135px">'+LeftSyncItemCharacteristics.state+'</span></td>';
  1402.             }
  1403.         
  1404.         if(RightSyncItemCharacteristics.state == '')
  1405.             {
  1406.             RightSyncItemCharacteristics_html = '<td width="50%" class="SyncAttrName" rowspan="2">'+
  1407.                         RightSyncItemCharacteristics.name+'</td>'+
  1408.                     '<td class="SyncAttribute" title="'+external.LS("tooltip_file_size")+'" rowspan="2">'+
  1409.                         '<span style="width:40px">'+RightSyncItemCharacteristics.size+'</span></td>'+
  1410.                     '<td class="SyncAttribute" nowrap title="'+external.LS("tooltip_file_time")+'" rowspan="2">'+
  1411.                         '<span style="width:90px">'+RightSyncItemCharacteristics.time+'</span></td>';
  1412.             }
  1413.             else
  1414.             {
  1415.             if(RightSyncItemCharacteristics.if_missing == true)
  1416.                 {
  1417.                 State_style = 'style="color:red"';
  1418.                 }
  1419.                 else
  1420.                 {
  1421.                 var State_style = '';
  1422.                 }
  1423.             RightSyncItemCharacteristics_html = '<td width="50%" class="SyncAttrName" rowspan="2">'+
  1424.                         RightSyncItemCharacteristics.name+'</td>'+
  1425.                     '<td class="SyncAttrState" colspan="2" valign="middle" align="center" nowrap '+State_style+'" rowspan="2">'+
  1426.                         '<span style="width:135px">'+RightSyncItemCharacteristics.state+'</span></td>';
  1427.             }
  1428.         msg_html = '<tbody id="'+MsgObj.objID+'" class="'+TbodyClass+'"><tr>'+LeftSyncItemCharacteristics_html+ 
  1429.         '<td class="Arrow" valign="top">'+WinningArrow+'</td><td class="MoreArrow" valign="top">'+MoreMarker+'</td>'+RightSyncItemCharacteristics_html+
  1430.                   '</tr><tr>'+
  1431.         '<td id="AlternativesArrows" class="'+AltButtonsClass+'" colspan="2" nowrap>'+Alternatives_Arrows+'</td></tr></tbody>';
  1432.         return msg_html; 
  1433.         }
  1434.     else    // Message is not sync item 
  1435.         {
  1436.         msg_html = '<tbody id="'+MsgObj.objID+'" class="'+TbodyClass+'"><tr>'+
  1437.             '<td colspan="8" class="info_msg">'+ MsgObj.ToString()+CreateMsgButtons(MsgObj)+'</td></tr></tbody>';
  1438.         return msg_html;
  1439.         };
  1440.     }
  1441.  
  1442. function BuildMessageAsObject(message_tbody_element, CollectionID, MessageID, MsgEvenness)
  1443.     {
  1444. //    MsgEvenness = 1;// Debug line, change later
  1445.     if(MsgEvenness == 0)
  1446.         {
  1447.         TbodyClass = "Msg_Even";
  1448.         }
  1449.         else
  1450.         {
  1451.         TbodyClass = "Msg_Odd";
  1452.         }
  1453.     var MsgObj = external.ObjByID(MessageID);
  1454.     MsgObj.SetM(CollectionID, 1);    //MM_FlagNotifyScript to 1
  1455.     var AssociationObj    = MsgObj.GetM('CLASS_CSolutionDoAssociationSync');
  1456.     var AssociationID = AssociationObj.objID;
  1457.     message_tbody_element.id = MessageID;
  1458.     message_tbody_element.className = TbodyClass;
  1459.     var tbody_length = message_tbody_element.rows.length;
  1460.     for(i=0; i<tbody_length; i++)
  1461.             {
  1462.             message_tbody_element.deleteRow();
  1463.             }
  1464.     var main_line_element = message_tbody_element.insertRow();
  1465.     if(MsgObj.IsSyncItemMsg())
  1466.         {
  1467.         var solution = MsgObj.GetObjM('MM_Solution');
  1468.         if(solution == null) 
  1469.             {
  1470.             alert("solution == null");
  1471.             return "";
  1472.             }
  1473.         var SyncTreeList = AssociationObj.GetM('CLASS_CSyncTree');
  1474.         var SyncTree1_Obj = SyncTreeList.GetFirst();
  1475.         var SyncTree2_Obj = SyncTreeList.GetNext(SyncTree1_Obj);
  1476.         var SyncTreeId_1 = SyncTree1_Obj.GetM('MM_TreeID'); 
  1477.         var SyncTreeId_2 = SyncTree2_Obj.GetM('MM_TreeID'); 
  1478.         var WinningTreeID = solution.GetM('MM_WinningTreeID'); 
  1479.         var SolutionActionState = solution.GetM('MM_ActionState'); 
  1480.         var WinningArrow = "Attention!!!";
  1481.         var MoreMarker = "X";
  1482. //        alert('SyncTreeId_1 == '+SyncTreeId_1);
  1483.         var file1_name = solution.Method1ID('M_CreateFullPathStrByTreeID',SyncTreeId_1); 
  1484. //        alert('file1_name == '+file1_name);
  1485. //        alert('SyncTreeId_2 == '+SyncTreeId_2);
  1486.         var file2_name = solution.Method1ID('M_CreateFullPathStrByTreeID',SyncTreeId_2); 
  1487. //        alert('file2_name == '+file2_name);
  1488.         LeftSyncItemCharacteristics = new CreateSyncItemCharacteristics(solution,SyncTreeId_1); 
  1489.         RightSyncItemCharacteristics = new CreateSyncItemCharacteristics(solution,SyncTreeId_2);
  1490.         if((SolutionActionState == null)||(SolutionActionState == C_ACTION_STATE_INIT)) //ACTION_STATE_INIT
  1491.             {
  1492.             if (WinningTreeID == SyncTreeId_1) 
  1493.                 {
  1494.                 tooltip_1 = external.LS("tooltip_copy")+' '+file1_name+' '+external.LS("tooltip_to")+' '+file2_name;
  1495.                 tooltip_2 = external.LS("tooltip_more_alt");
  1496.                 if(LeftSyncItemCharacteristics.if_missing != true)
  1497.                     {
  1498.                     WinningArrow='<img src="Pics/Arrow1.gif" title="'+tooltip_1+'">';
  1499.                     }
  1500.                     else
  1501.                     {
  1502.                     WinningArrow='<img src="Pics/Arrow1_del.gif" title="'+tooltip_1+'">';
  1503.                     }
  1504.                 MoreMarker = '<img association_id="'+AssociationObj.objID+'" parent_msg_id="'+MsgObj.objID+'" onclick=ShowAltArrows() src="Pics/More.gif" title="'+tooltip_2+'">'; //+external.LS("tooltip_more_alt")+
  1505.                 }
  1506.             else if (WinningTreeID == SyncTreeId_2) 
  1507.                 {
  1508.                 tooltip_1 = external.LS("tooltip_copy")+' '+file2_name+' '+external.LS("tooltip_to")+' '+file1_name;
  1509.                 tooltip_2 = external.LS("tooltip_more_alt");
  1510.                 if(RightSyncItemCharacteristics.if_missing != true)
  1511.                     {
  1512.                     WinningArrow='<img src="Pics/Arrow2.gif" title="'+tooltip_1+'">';
  1513.                     }
  1514.                     else
  1515.                     {
  1516.                     WinningArrow='<img src="Pics/Arrow2_del.gif" title="'+tooltip_1+'">';
  1517.                     }
  1518.                 MoreMarker = '<img association_id="'+AssociationObj.objID+'" parent_msg_id="'+MsgObj.objID+'" onclick=ShowAltArrows() src="Pics/More.gif" title="'+tooltip_2+'">';
  1519.                 }
  1520.             else if (WinningTreeID == C_CID) //CID 
  1521.                 {
  1522.                 tooltip_1 = external.LS("tooltip_CID_arrow");
  1523.                 tooltip_2 = external.LS("tooltip_more_alt");
  1524.                 WinningArrow='<img src="Pics/Arrow3.gif" title="'+tooltip_1+'">';
  1525.                 MoreMarker = '<img association_id="'+AssociationObj.objID+'" parent_msg_id="'+MsgObj.objID+'" onclick=ShowAltArrows() src="Pics/More.gif" title="'+tooltip_2+'">';
  1526.                 }
  1527.             }
  1528.         else if(SolutionActionState == C_ACTION_STATE_IN_PROGRESS) //ACTION_STATE_IN_PROGRESS
  1529.             {
  1530.             if (WinningTreeID == SyncTreeId_1) 
  1531.                 {
  1532.                 WinningArrow='<img src="Pics/Arrow1_progressed.gif" title="'+external.LS("tooltip_action_in_progress")+'">';
  1533.                 MoreMarker = '<img src="Pics/More.gif">';
  1534.                 }
  1535.             else if (WinningTreeID == SyncTreeId_2) 
  1536.                 {
  1537.                 WinningArrow='<img src="Pics/Arrow2_progressed.gif" title="'+external.LS("tooltip_action_in_progress")+'">';
  1538.                 MoreMarker = '<img src="Pics/More.gif">';
  1539.                 }
  1540.             else if (WinningTreeID == C_CID) //CID
  1541.                 {
  1542.                 tooltip_1 = external.LS("tooltip_CID_arrow");
  1543.                 WinningArrow='<img src="Pics/Arrow3.gif" title="'+tooltip_1+'">';
  1544.                 MoreMarker = '<img src="Pics/More.gif">';
  1545.                 }
  1546.             }
  1547.         else if(SolutionActionState == C_ACTION_STATE_DONE) //ACTION_STATE_DONE
  1548.             {
  1549.             if (WinningTreeID == SyncTreeId_1) 
  1550.                 {
  1551.                 tooltip_1 = external.LS("tooltip_action_done");
  1552.                 if(LeftSyncItemCharacteristics.if_missing != true)
  1553.                     {
  1554.                     WinningArrow='<img src="Pics/Arrow1_gray.gif" title="'+tooltip_1+'">';
  1555.                     }
  1556.                     else
  1557.                     {
  1558.                     WinningArrow='<img src="Pics/Arrow1_del_gray.gif" title="'+tooltip_1+'">';
  1559.                     }    
  1560. //                WinningArrow='<img src="Pics/Arrow1_gray.gif" title="'+external.LS("tooltip_action_done")+'">';
  1561.                 MoreMarker = '<img src="Pics/More_ok.gif">';
  1562.                 }
  1563.             else if (WinningTreeID == SyncTreeId_2) 
  1564.                 {
  1565.                 tooltip_1 = external.LS("tooltip_action_done");
  1566.                 if(RightSyncItemCharacteristics.if_missing != true)
  1567.                     {
  1568.                     WinningArrow='<img src="Pics/Arrow2_gray.gif" title="'+tooltip_1+'">';
  1569.                     }
  1570.                     else
  1571.                     {
  1572.                     WinningArrow='<img src="Pics/Arrow2_del_gray.gif" title="'+tooltip_1+'">';
  1573.                     }
  1574. //                WinningArrow='<img src="Pics/Arrow2_gray.gif" title="'+external.LS("tooltip_action_done")+'">';
  1575.                 MoreMarker = '<img src="Pics/More_ok.gif">';
  1576.                 }
  1577.             else if (WinningTreeID == C_CID) //CID
  1578.                 {
  1579.                 WinningArrow='<img src="Pics/Arrow3_gray.gif"  title="'+external.LS("tooltip_action_done")+'">';
  1580.                 MoreMarker = '<img src="Pics/More_ok.gif">';
  1581.                 }
  1582.             }
  1583.         Severity = MsgObj.Method0('M_GetStackSeverity');
  1584.         /*if((Severity >= C_ERR_QUESTION)&&((SolutionActionState == null)||(SolutionActionState == C_ACTION_STATE_INIT))) // C_ERR_QUESTION = 6000 
  1585.             {
  1586.             Alternatives_Arrows =  MakeAltArrows(AssociationObj, solution);
  1587.             AltArrowsClass = "AltButtonsExpanded";
  1588.             tooltip_2 = external.LS("tooltip_hide_alt");
  1589.             MoreMarker = '<img association_id="'+AssociationObj.objID+'" parent_msg_id="'+
  1590.                     MsgObj.objID+'" onclick=HideAltArrows() src="Pics/More_up.gif" title="'+tooltip_2+'">';
  1591.             }
  1592.             else*/
  1593.             {
  1594.             Alternatives_Arrows =  '';
  1595.             AltArrowsClass = "AltButtonsCollapsed";
  1596.             }
  1597.         if(LeftSyncItemCharacteristics.state == '')
  1598.             {
  1599.             name_element = main_line_element.insertCell();
  1600.             name_element.width="50%";
  1601.             name_element.className="SyncAttrName";
  1602.             name_element.rowSpan = "2";
  1603.             name_element.innerHTML = LeftSyncItemCharacteristics.name;
  1604.             size_element = main_line_element.insertCell();
  1605.             size_element.className="SyncAttribute";
  1606.             size_element.rowSpan = "2";
  1607.             size_element.title = external.LS("tooltip_file_size");
  1608.             size_element.innerHTML = '<span style="width:40px">'+LeftSyncItemCharacteristics.size+'</span>';
  1609.             time_element = main_line_element.insertCell();
  1610.             time_element.className="SyncAttribute";
  1611.             time_element.rowSpan = "2";
  1612.             time_element.noWrap = true;
  1613.             time_element.title = external.LS("tooltip_file_time");
  1614.             time_element.innerHTML = '<span style="width:90px">'+LeftSyncItemCharacteristics.time+'</span>';
  1615.             }
  1616.             else
  1617.             {
  1618.             name_element = main_line_element.insertCell();
  1619.             name_element.className="SyncAttrName";
  1620.             name_element.rowSpan = "2";
  1621.             name_element.width="50%";
  1622.             name_element.innerHTML = LeftSyncItemCharacteristics.name;
  1623.             state_element = main_line_element.insertCell();
  1624.             state_element.className="SyncAttrState";
  1625.             state_element.rowSpan = "2";
  1626.             state_element.colSpan="2";
  1627.             state_element.align="center";
  1628.             state_element.noWrap=true;
  1629.             if(LeftSyncItemCharacteristics.if_missing == true)
  1630.                 {
  1631.                 state_element.style.color="red";
  1632.                 }
  1633.             state_element.innerHTML = '<span style="width:135px">'+LeftSyncItemCharacteristics.state+'</span>';
  1634.             }
  1635.         WinningArrow_element = main_line_element.insertCell();
  1636.         WinningArrow_element.className = "Arrow";
  1637.         WinningArrow_element.vAlign = "top";
  1638.         WinningArrow_element.innerHTML = WinningArrow;
  1639.         MoreMarker_element = main_line_element.insertCell();
  1640.         MoreMarker_element.className="MoreArrow";
  1641.         MoreMarker_element.vAlign = "top";
  1642.         MoreMarker_element.innerHTML = MoreMarker;
  1643.         if(RightSyncItemCharacteristics.state == '')
  1644.             {
  1645.             name_element = main_line_element.insertCell();
  1646.             name_element.width="50%";
  1647.             name_element.className="SyncAttrName";
  1648.             name_element.rowSpan = "2";
  1649.             name_element.innerHTML = RightSyncItemCharacteristics.name;
  1650.             size_element = main_line_element.insertCell();
  1651.             size_element.className="SyncAttribute";
  1652.             size_element.rowSpan = "2";
  1653.             size_element.title = external.LS("tooltip_file_size");
  1654.             size_element.innerHTML = '<span style="width:40px">'+RightSyncItemCharacteristics.size+'</span>';
  1655.             time_element = main_line_element.insertCell();
  1656.             time_element.className="SyncAttribute";
  1657.             time_element.rowSpan = "2";
  1658.             time_element.noWrap = true;
  1659.             time_element.title = external.LS("tooltip_file_time");
  1660.             time_element.innerHTML = '<span style="width:90px">'+RightSyncItemCharacteristics.time+'</span>';
  1661.             }
  1662.             else
  1663.             {
  1664.             name_element = main_line_element.insertCell();
  1665.             name_element.className="SyncAttrName";
  1666.             name_element.rowSpan = "2";
  1667.             name_element.width="50%";
  1668.             name_element.innerHTML = RightSyncItemCharacteristics.name;
  1669.             state_element = main_line_element.insertCell();
  1670.             state_element.className="SyncAttrState";
  1671.             state_element.rowSpan = "2";
  1672.             state_element.colSpan="2";
  1673.             state_element.align="center";
  1674.             state_element.noWrap=true;
  1675.             if(RightSyncItemCharacteristics.if_missing == true)
  1676.                 {
  1677.                 state_element.style.color="red";
  1678.                 }
  1679.             state_element.innerHTML = '<span style="width:135px">'+RightSyncItemCharacteristics.state+'</span>';
  1680.             }
  1681.         addline_element = message_tbody_element.insertRow();
  1682.         addline_cell_element = addline_element.insertCell();
  1683.         addline_cell_element.id ="AlternativesArrows";
  1684.         addline_cell_element.colSpan="2";
  1685.         addline_cell_element.className = AltArrowsClass;
  1686.         addline_cell_element.innerHTML = Alternatives_Arrows;
  1687.         }
  1688.     else    // Message is not sync item 
  1689.         {
  1690.         mainline_cell_element = main_line_element.insertCell();
  1691.         mainline_cell_element.className="info_msg";
  1692.         mainline_cell_element.colSpan="8";
  1693.         mainline_cell_element.innerHTML = MsgObj.ToString()+CreateMsgButtons(MsgObj);
  1694.         return;
  1695.         }
  1696.     }
  1697.  
  1698.  
  1699. function ExtAddNewMsg(MsgCollectionObjID, MsgObjID)
  1700.     {
  1701.     var msg = external.ObjByID(MsgObjID);
  1702.     if(msg == null) 
  1703.         {
  1704.         alert("msg == null");
  1705.         return;
  1706.         }
  1707.     var Association    = msg.GetM('CLASS_CSolutionDoAssociationSync');
  1708.     AssociationID = Association.objID;
  1709.     if(G_Associations[AssociationID].TreeView._collections[MsgCollectionObjID] == null)
  1710.         {
  1711.         return;
  1712.         }
  1713.     G_Associations[AssociationID].TreeView.add_message_node(MsgCollectionObjID, MsgObjID);
  1714.     }
  1715.  
  1716.  
  1717. function ExtChangeMsg(MsgCollectionObjID, MsgObjID)
  1718.     {
  1719.     msg = external.ObjByID(MsgObjID);
  1720.     AssociationID = msg.GetM('CLASS_CSolutionDoAssociationSync').objID;
  1721.     if(G_Associations[AssociationID].TreeView._collections[MsgCollectionObjID] == null)
  1722.         {
  1723.         return;
  1724.         }    
  1725.     collection_container = document.getElementById('Association_'+AssociationID).all[MsgCollectionObjID+'_container']; 
  1726.     if(msg == null) 
  1727.         {
  1728.         alert("ExtChangeMsg: Message "+MsgObjID+" does not exist!");
  1729.         return;
  1730.         }
  1731.     if(collection_container == null)
  1732.         {
  1733.         if(G_Associations[AssociationID].TreeView.root._children[MsgCollectionObjID]._first_disp_msg != MsgObjID)
  1734.             {
  1735.             msg.SetM(MsgCollectionObjID, null);    //MM_FlagNotifyScript to null
  1736.             }
  1737.         return;
  1738.         }
  1739.     message_element = collection_container.children[MsgObjID]; 
  1740.     if(message_element != null)
  1741.         {
  1742.         if(message_element.className == "Msg_Odd")
  1743.             {
  1744.             MsgEvenness = 1;
  1745.             }
  1746.             else
  1747.             {
  1748.             MsgEvenness = 0;
  1749.             }
  1750.         BuildMessageAsObject(message_element, MsgCollectionObjID, MsgObjID, MsgEvenness); 
  1751. //        message_element.scrollIntoView(true);
  1752.         }
  1753.         else
  1754.         {
  1755.         msg = external.ObjByID(MsgObjID);
  1756.         msg.SetM(MsgCollectionObjID, null);    //MM_FlagNotifyScript to null
  1757.         }
  1758.     }
  1759.  
  1760. function ExtRemoveMsg(MsgCollectionObjID, MsgObjID)
  1761.     {
  1762.     msg = external.ObjByID(MsgObjID);
  1763.     AssociationID = msg.GetM('CLASS_CSolutionDoAssociationSync').objID;
  1764.     
  1765.     if(G_Associations[AssociationID].TreeView._collections[MsgCollectionObjID] == null)
  1766.         {
  1767. /*        alert('Error 1620: \n'
  1768.             +'AssociationID = '+AssociationID+',\n'
  1769.             +'G_Associations = '+G_Associations+',\n'
  1770.             +'G_Associations['+AssociationID+'] = '+G_Associations[AssociationID]+',\n'
  1771.             +'G_Associations['+AssociationID+'].TreeView = '+G_Associations[AssociationID].TreeView+',\n'
  1772.             +'G_Associations['+AssociationID+'].TreeView._collections = '+G_Associations[AssociationID].TreeView._collections+',\n'
  1773.             +'G_Associations['+AssociationID+'].TreeView._collections['+MsgCollectionObjID+'] = '+G_Associations[AssociationID].TreeView._collections[MsgCollectionObjID]);    */    
  1774.         return;
  1775.         }
  1776.     
  1777.     
  1778.     msgs = G_Associations[AssociationID].TreeView._collections[MsgCollectionObjID].obj;
  1779.     msg.SetM(MsgCollectionObjID, null);
  1780.     collection_node = G_Associations[AssociationID].TreeView.root._children[MsgCollectionObjID];
  1781.     if(msgs.Method0('M_GetCount') == 0) // if M_GetCount == 0
  1782.         {
  1783.         collection_node._first_disp_msg = null;
  1784.         collection_node._empty = true;
  1785.         G_Associations[AssociationID].TreeView.redraw_collection(MsgCollectionObjID);
  1786.         return;
  1787.         }
  1788.     if(collection_node._expanded == 0)    //Collection collapsed and M_GetCount > 0
  1789.         {
  1790.         if(MsgObjID == collection_node._first_disp_msg)
  1791.             {
  1792.             collection_node._first_disp_msg = null;
  1793.             G_Associations[AssociationID].TreeView.redraw_collection(MsgCollectionObjID);    //??? May be so...
  1794.             }
  1795.         return;
  1796.         }
  1797.     collection_container = document.getElementById('Association_'+AssociationID).all[MsgCollectionObjID+'_container'];
  1798.     deleted_message_element = collection_container.children[MsgObjID];
  1799.     if(deleted_message_element == null)    // Deleted element is not on the page
  1800.         {
  1801. //        alert('Deleted element is not on the page');
  1802.         return;
  1803.         }
  1804.     page_length = collection_container.children.length;
  1805.     if(page_length == 1) // Deleted element is the sole element on the page
  1806.         {
  1807.         collection_node._first_disp_msg = msgs.GetFirst().objID;
  1808.         msgs.ObjByID(collection_node._first_disp_msg).SetM(MsgCollectionObjID, 1); //???
  1809.         G_Associations[AssociationID].TreeView.redraw_collection(MsgCollectionObjID);
  1810.         return;
  1811.         }
  1812.     if(deleted_message_element.id == collection_container.children[0].id) // Deleted element is the first element on the pege
  1813.         {
  1814.         collection_node._first_disp_msg = collection_container.children[1].id;
  1815.         }
  1816.     deleted_message_element.removeNode(true); // Delete the element and all it's children
  1817.     page_length = collection_container.children.length;
  1818.     AdditionalAttributes = msgs.Method0Own('M_GetAdditionalAttributeMap');
  1819.     if ((msgs.GetLast().objID) != (collection_container.children(page_length-1).id)) // Adds message to the end of the page, if last message is not on it    
  1820.             {
  1821.             last_on_page_msg = msgs.ObjByID(collection_container.children(page_length-1).id);
  1822.             var new_last_message_element = document.createElement('tbody');
  1823.             collection_container.appendChild(new_last_message_element);
  1824.             New_on_page_message_ID = msgs.GetNext(last_on_page_msg).objID;
  1825.             if(last_on_page_msg.className == "Msg_Odd")
  1826.                 {
  1827.                 NewMsgEvenness = 0;
  1828.                 }
  1829.                 else
  1830.                 {
  1831.                 NewMsgEvenness = 1;
  1832.                 }
  1833.             BuildMessageAsObject(new_last_message_element, MsgCollectionObjID, New_on_page_message_ID, NewMsgEvenness); 
  1834.             if(New_on_page_message_ID == msgs.GetLast().objID)    //New message on page is last in collection, then remove "Next" control
  1835.                 {
  1836.                 AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
  1837.                 RefreshMsgScrollers(document.getElementById('Association_'+AssociationID), "next", false, MsgCollectionObjID, true);
  1838.                 }
  1839.             }
  1840.             else
  1841.             {
  1842.             AdditionalAttributes.SetM('MM_FlagNotifyScript', true);
  1843.             if((msgs.GetFirst().objID) != (collection_container.children(0).id))
  1844.                 {
  1845.                 go_prev_message(MsgCollectionObjID);
  1846.                 RefreshMsgScrollers(document.getElementById('Association_'+AssociationID), "next", false, MsgCollectionObjID, true);
  1847.                 }
  1848.                 else
  1849.                 {
  1850.                 RefreshMsgScrollers(document.getElementById('Association_'+AssociationID), "prev", false, MsgCollectionObjID, false);
  1851.                 RefreshMsgScrollers(document.getElementById('Association_'+AssociationID), "next", false, MsgCollectionObjID, false);
  1852.                 }
  1853.             }
  1854.     RestoreCollectionZebra(AssociationID, MsgCollectionObjID);
  1855.     return;        
  1856.     }
  1857.  
  1858. function RestoreCollectionZebra(AssociationID, CollectionID)
  1859.     {
  1860.     AssociationElement = document.getElementById('Association_'+AssociationID);
  1861.     collection_container = AssociationElement.all[CollectionID+'_container']; 
  1862.     if(collection_container == null)
  1863.         {
  1864.         return;
  1865.         }    
  1866.     list_length = collection_container.children.length;
  1867.     FirstMsgEvenness = G_Associations[AssociationID].TreeView.root._children[CollectionID]._first_disp_msg_evenness;
  1868.      for(var i=1; i<list_length; i++)
  1869.         {
  1870.         if((FirstMsgEvenness+i)%2 == 0)
  1871.             {
  1872.             collection_container.children(i).className = 'Msg_Even';
  1873.             }
  1874.             else
  1875.             {
  1876.             collection_container.children(i).className = 'Msg_Odd';
  1877.             }
  1878.         }
  1879.     }
  1880.  
  1881. function MakeAltArrows(AssociationObj, solution)
  1882.     {
  1883.     SyncTreeList = AssociationObj.GetM('CLASS_CSyncTree');
  1884.     SyncTree1_Obj = SyncTreeList.GetFirst();
  1885.     SyncTree2_Obj = SyncTreeList.GetNext(SyncTree1_Obj);
  1886.     SyncTreeId_1 = SyncTree1_Obj.GetM('MM_TreeID'); 
  1887.     SyncTreeId_2 = SyncTree2_Obj.GetM('MM_TreeID');
  1888.     file1_name = solution.Method1ID('M_CreateFullPathStrByTreeID',SyncTreeId_1); 
  1889.     file2_name = solution.Method1ID('M_CreateFullPathStrByTreeID',SyncTreeId_2);
  1890.     Alternatives_Arrows = '';
  1891.     arrow_shift=1;
  1892.     tooltip_1 = external.LS("tooltip_copy")+' '+file1_name+' '+external.LS("tooltip_to")+' '+file2_name;
  1893.     Alternatives_Arrows += '<img style="position:relative; left:'+arrow_shift+'px; top:0px; cursor:hand; " onclick=OnArrowClick("'+ 
  1894.                         solution.objID+'","'+ SyncTreeId_1+ '") onmousedown=ArrowButtonPressed("right") '+
  1895.                 ' onmouseover=ArrowButtonHi("right","on") onmouseout=ArrowButtonHi("right","off")'+
  1896.                 ' src="Pics/Arrow1_but.gif" title="'+tooltip_1+'">';
  1897.     arrow_shift+=0;
  1898.     tooltip_1 = external.LS("tooltip_copy")+' '+file2_name+' '+external.LS("tooltip_to")+' '+file1_name;
  1899.     Alternatives_Arrows += '<img style="position:relative; left:'+arrow_shift+'px; top:0px; cursor:hand; " onclick=OnArrowClick("'+     
  1900.                         solution.objID+'","'+ SyncTreeId_2+ '") onmousedown=ArrowButtonPressed("left") '+
  1901.                     'onmouseover=ArrowButtonHi("left","on") onmouseout=ArrowButtonHi("left","off")'+
  1902.                     ' src="Pics/Arrow2_but.gif"  title="'+tooltip_1+'">';
  1903.     arrow_shift+=0;
  1904.     tooltip_1 = external.LS("tooltip_CID_arrow");
  1905.     Alternatives_Arrows += '<img style="position:relative; left:'+arrow_shift+'px; top:0px; cursor:hand; " onclick=OnArrowClick("'+    
  1906.                         solution.objID+'","CID") onmousedown=ArrowButtonPressed("CID") '+
  1907.                     'onmouseover=ArrowButtonHi("CID","on") onmouseout=ArrowButtonHi("CID","off")'+
  1908.                     ' src="Pics/Arrow3_but.gif"  title="'+tooltip_1+'">';
  1909.     return Alternatives_Arrows;
  1910.     };
  1911.  
  1912. function ArrowButtonHi(button_direction,hi)
  1913.     {
  1914.     arr_button = window.event.srcElement;
  1915.     var Picture = document.getElementById('Association_'+G_ActiveAssociationID).all['Flying_picture'];
  1916.     if(button_direction == "right")
  1917.         if(hi == "on") 
  1918.             {
  1919.             arr_button.src = "Pics/Arrow1_but_hi.gif";
  1920.             Picture.src = 'Pics/DocToRight.gif';
  1921.             } 
  1922.             else 
  1923.             {
  1924.             arr_button.src = "Pics/Arrow1_but.gif";
  1925.             Picture.src = 'Pics/MiddleArrow40.gif';
  1926.  
  1927.             }
  1928.     else if(button_direction == "left")
  1929.         if(hi == "on") 
  1930.             {
  1931.             arr_button.src = "Pics/Arrow2_but_hi.gif";
  1932.             Picture.src = 'Pics/DocToLeft.gif';
  1933.             } 
  1934.             else 
  1935.             {
  1936.             arr_button.src = "Pics/Arrow2_but.gif";
  1937.             Picture.src = 'Pics/MiddleArrow40.gif';
  1938.             }
  1939.     else if(button_direction == "CID")
  1940.         if(hi == "on") 
  1941.             {
  1942.             arr_button.src = "Pics/Arrow3_but_hi.gif";
  1943.             } 
  1944.             else 
  1945.             {
  1946.             arr_button.src = "Pics/Arrow3_but.gif"; 
  1947.             }
  1948.     }
  1949.  
  1950. function ArrowButtonPressed(button_direction)
  1951.     {
  1952.     arr_button = window.event.srcElement;
  1953.     if(button_direction == "right")
  1954.         arr_button.src = "Pics/Arrow1_but_press.gif";
  1955.     if(button_direction == "left")
  1956.         arr_button.src = "Pics/Arrow2_but_press.gif";
  1957.     if(button_direction == "CID")
  1958.         arr_button.src = "Pics/Arrow3_but_press.gif";
  1959.     }
  1960.  
  1961. function ShowAltArrows()
  1962.     {
  1963.     more_element = window.event.srcElement;
  1964.     MsgID = more_element.parent_msg_id;
  1965.     AssociationID = more_element.association_id;
  1966.     AssociationObj = external.ObjByID(AssociationID);
  1967.     MsgObj = external.ObjByID(MsgID);
  1968.     if(MsgObj.IsSyncItemMsg())
  1969.         {
  1970.         solution = MsgObj.GetObjM('MM_Solution');
  1971.         if(solution == null) 
  1972.             {
  1973.             alert("solution == null");
  1974.             return "";
  1975.             }
  1976.         message_element = more_element;
  1977.         for(i=0; i<3; i++)
  1978.             {
  1979.             message_element = message_element.parentElement;
  1980.             }
  1981.         arrows_element = message_element.all["AlternativesArrows"];
  1982.         arrows_element.className = "AltButtonsExpanded";
  1983.         arrows_element.innerHTML = MakeAltArrows(AssociationObj, solution);
  1984.         tooltip = external.LS("tooltip_hide_alt");
  1985.         more_element.src = "Pics/More_up.gif";
  1986.         more_element.onclick = HideAltArrows;
  1987.         more_element.title = external.LS("tooltip_hide_alt");
  1988.         }
  1989.         else
  1990.         {
  1991.         return '';
  1992.         }
  1993.     
  1994.     }
  1995.  
  1996. function HideAltArrows()
  1997.     {
  1998.     more_element = window.event.srcElement;
  1999.     MsgID = more_element.parent_msg_id;
  2000.     MsgObj = external.ObjByID(MsgID);
  2001.     if(MsgObj.IsSyncItemMsg())
  2002.         {
  2003.         solution = MsgObj.GetObjM('MM_Solution');
  2004.         if(solution == null) 
  2005.             {
  2006.             alert("solution == null");
  2007.             return "";
  2008.             }
  2009.         message_element = more_element;
  2010.         for(i=0; i<3; i++)
  2011.             {
  2012.             message_element = message_element.parentElement;
  2013.             }
  2014.         arrows_element = message_element.all["AlternativesArrows"];
  2015.         arrows_element.className = "AltButtonsCollapsed";
  2016.         arrows_element.innerHTML = "";
  2017.         tooltip = external.LS("tooltip_more_alt");
  2018.         more_element.src = "Pics/More.gif";
  2019.         more_element.onclick = ShowAltArrows;
  2020.         more_element.title = external.LS("tooltip_more_alt");
  2021.         }
  2022.         else
  2023.         {
  2024.         return "";
  2025.         }
  2026.     }
  2027.  
  2028. function CreateSyncItemCharacteristics(solution,TreeID)
  2029.     {
  2030.     this.name = '';
  2031.     this.size = '';
  2032.     this.time = '';
  2033.     this.state = '';
  2034.     this.if_missing = false;
  2035.     file_SIC= solution.Method1IDOwn('M_GetSyncItemCharacteristicsByTreeID',TreeID); 
  2036.     this.name = solution.Method1ID('M_CreateFullPathStrByTreeID',TreeID); 
  2037.     this.name = this.name.replace(/\\/g,"\\<wbr>");
  2038.     SolutionActionState = solution.GetM('MM_ActionState'); 
  2039.     if(SolutionActionState == C_ACTION_STATE_DONE) 
  2040.         {
  2041.         AfterActionState = solution.Method1IDOwn('M_GetActionDoneUserStrByTreeID',TreeID); 
  2042.         if(AfterActionState != null)
  2043.             {
  2044.             this.state = AfterActionState;
  2045.             return this;
  2046.             }
  2047.         }
  2048.     if(file_SIC.GetM('MM_Missing') == 1)
  2049.         {
  2050.         this.state = external.LS("str_not_exist");
  2051.         this.if_missing = true;
  2052.         return this;
  2053.         }
  2054.     file_size = file_SIC.Method0('M_GetFileSizeStr');
  2055.     if(file_size != null)
  2056.         {
  2057.         this.size = file_size;
  2058.         }
  2059.     file_time = file_SIC.Method0('M_GetFiletimeStr');
  2060.     if(file_time != null)
  2061.         {
  2062.         this.time = file_time;
  2063.         }
  2064.     return this;
  2065.     }
  2066.  
  2067.  
  2068. function CreateMsgButtons(MsgObj)
  2069.     {
  2070.     var msg_buttons = MsgObj.GetObjM('MM_UserButtons');
  2071.     buttons_html = "";
  2072.     if(msg_buttons != null) 
  2073.         {
  2074.         buttons_html += "<br/>";
  2075.         var button = msg_buttons.GetFirst();
  2076.         buttons_html += '<span style="white-space:nowrap; padding-left:20px;">';
  2077.         while(button) 
  2078.             {
  2079.             buttons_html += '<BUTTON onclick=OnMsgButton("' + button.objID + '") class="msg_button">' +
  2080.                                     button.ToString() +
  2081.                                 '</BUTTON>';
  2082.             button = msg_buttons.GetNext(button);
  2083.             }
  2084.         buttons_html += '</span>';
  2085.         }
  2086. /*    buttons_html = '<span style="white-space:nowrap; padding-left:20px;"><BUTTON class="msg_button">Test_1</BUTTON>'
  2087.                 +'<BUTTON class="msg_button">Test_2</BUTTON>'+
  2088.                 '<BUTTON class="msg_button">Test_3</BUTTON></span>';*/
  2089.     return buttons_html;
  2090.     }
  2091.  
  2092. function OnArrowClick(SolutionID,TreeID)
  2093.     {
  2094.     document.getElementById('Association_'+G_ActiveAssociationID).all['Flying_picture'].src = 'Pics/MiddleArrow40.gif';
  2095.     solution = external.ObjByID(SolutionID);
  2096.     solution.Method1ID('M_AlternativeSelected',TreeID);
  2097.     }
  2098.  
  2099. function OnMsgButton(button_objID) 
  2100.     {
  2101.     var button = external.ObjByID(button_objID);
  2102.     if(button == null) return;
  2103.     button.Method('M_ButtonPressed');
  2104.     }
  2105.  
  2106. function Ok_Activate(num)
  2107.     {
  2108.     Form_elem = document.getElementById('Association_'+G_ActiveAssociationID).all["TreeForm"+num];
  2109.     SyncTreeID = Form_elem.parentElement.synctree_id;
  2110.     new_path = Form_elem.all[SyncTreeID+'_path'].value;
  2111.     if(Form_elem.is_empty == "false")
  2112.         {
  2113.         old_path = external.ObjByID(SyncTreeID).Method0Own('M_CreateTreeRootPath').Method0Own('M_ToFilename'); 
  2114.         }
  2115.         else
  2116.         {
  2117.         old_path = "";
  2118.         }
  2119.     if(new_path != old_path)
  2120.         {
  2121.         Form_elem.all["TreeOk"+num].disabled = false;
  2122.         Form_elem.all["TreeCancel"+num].disabled = false;
  2123.         Form_elem.is_changed = "true";
  2124.         }
  2125.         else
  2126.         {
  2127.         Form_elem.all["TreeOk"+num].disabled = true;
  2128.         Form_elem.all["TreeCancel"+num].disabled = true;
  2129.         Form_elem.is_changed = "false";
  2130.         }
  2131.     }
  2132.  
  2133. function GetBackSyncBoard(num)
  2134.     {
  2135.     SyncTree_elem = document.getElementById('Association_'+G_ActiveAssociationID).all["SyncTree"+num];
  2136.     SyncTreeID = SyncTree_elem.synctree_id;
  2137.     SyncTreeObj = external.ObjByID(SyncTreeID);
  2138.     if(SyncTreeObj.Method0('M_IsTreeReady') == 1)
  2139.         {
  2140.         SyncTree_path = SyncTreeObj.Method0Own('M_CreateTreeRootPath').Method0Own('M_ToFilename'); 
  2141.         if_empty = "false";
  2142.         }
  2143.         else
  2144.         {
  2145.         SyncTree_path ="";
  2146.         if_empty = "true";
  2147.         }
  2148.     SyncTree_elem.all[SyncTreeID+"_path"].value = SyncTree_path;
  2149.     SyncTree_elem.all["TreeForm"+num].is_changed = "false";
  2150.     SyncTree_elem.all["TreeForm"+num].is_empty = if_empty;
  2151.     SyncTree_elem.all["TreeOk"+num].disabled = true; 
  2152.     SyncTree_elem.all["TreeCancel"+num].disabled = true;
  2153.     }
  2154.  
  2155. function ExtOnProfileChanged()
  2156.     {
  2157.     if(Flag_can_reload_profile == false)
  2158.         {
  2159.         return;
  2160.         }
  2161.     RemoveAllAssociationsFromScreen();
  2162.     LoadProfile();
  2163.     ActivateAssociation(G_ActiveAssociationID);
  2164.     ExtUpdateButtons(G_ActiveAssociationID);
  2165.     }
  2166.  
  2167. function BuildAssociationTabsCaption(profileObj)
  2168.     {
  2169.     FirstAssociationID = profileObj.GetFirst().objID;
  2170.     Association = profileObj.GetLast();
  2171.     what_before = "empty";    // active, unactive
  2172.     Active_was_found = false;
  2173.     i=1;
  2174.     while(Association != null)
  2175.         {
  2176.         if((Active_was_found == false)&&(Association.objID == FirstAssociationID))
  2177.             {
  2178.             G_ActiveAssociationID = Association.objID;
  2179.             }
  2180.         separator_cell = TabsLabels.insertCell(0);
  2181.         Label_cell = TabsLabels.insertCell(0);
  2182.         if(Association.objID != G_ActiveAssociationID)
  2183.             {
  2184.             if(what_before == "unactive")
  2185.                 {
  2186.                 separator_cell.innerHTML = '<img src="Pics/TabCaptionPart7.gif">';
  2187.                 }
  2188.                 else if(what_before == "active")
  2189.                 {
  2190.                 separator_cell.innerHTML = '<img src="Pics/TabCaptionPart5.gif">';
  2191.                 }
  2192.                 else if(what_before == "empty")
  2193.                 {
  2194.                 separator_cell.innerHTML = '<img src="Pics/TabCaptionPart4.gif">';
  2195.                 }
  2196.             Label_cell.innerHTML = 'Association #'+i;
  2197.             Label_cell.style.backgroundImage = "url('Pics/TabCaptionMid1.gif')";
  2198.             Label_cell.noWrap = true;
  2199.             what_before = "unactive";
  2200.             }
  2201.             else
  2202.             {
  2203.             Active_was_found = true;
  2204.             if(what_before == "unactive")
  2205.                 {
  2206.                 separator_cell.innerHTML = '<img src="Pics/TabCaptionPart6.gif">';
  2207.                 }
  2208.                 else if(what_before == "empty")
  2209.                 {
  2210.                 separator_cell.innerHTML = '<img src="Pics/TabCaptionPart2.gif">';
  2211.                 }
  2212.             Label_cell.innerHTML = 'Association #'+i;
  2213.             Label_cell.style.backgroundImage = "url('Pics/TabCaptionMid2.gif')";
  2214.             Label_cell.noWrap = true;
  2215.             what_before = "active";
  2216.             }
  2217.         i++;
  2218.         Association = association_list.GetPrev(Association);
  2219.         }
  2220.     End_separator_cell = TabsLabels.insertCell(0);
  2221.     if(what_before == "active")
  2222.         {
  2223.         End_separator_cell.innerHTML = '<img src="Pics/TabCaptionPart1.gif">';
  2224.         }
  2225.         else
  2226.         {
  2227.         End_separator_cell.innerHTML = '<img src="Pics/TabCaptionPart3.gif">';
  2228.         }
  2229.     }
  2230.  
  2231. function BuildAssociationTabsCaption_Debug()
  2232.     {
  2233.     LabelsNumber = 9;
  2234.     ActiveLabel = 4;
  2235.     what_before = "empty";    // active, unactive
  2236.     Active_was_found = false;
  2237.     for(i=LabelsNumber; i>0; i--)
  2238.         {
  2239.         if((Active_was_found == false)&&(i == 1))
  2240.             {
  2241.             ActiveLabel = 1;
  2242.             }
  2243.         separator_cell = TabsLabels.insertCell(0);
  2244.         Label_cell = TabsLabels.insertCell(0);
  2245.         if(i != ActiveLabel)
  2246.             {
  2247.             if(what_before == "unactive")
  2248.                 {
  2249.                 separator_cell.innerHTML = '<img src="Pics/TabCaptionPart7.gif">';
  2250.                 }
  2251.                 else if(what_before == "active")
  2252.                 {
  2253.                 separator_cell.innerHTML = '<img src="Pics/TabCaptionPart5.gif">';
  2254.                 }
  2255.                 else if(what_before == "empty")
  2256.                 {
  2257.                 separator_cell.innerHTML = '<img src="Pics/TabCaptionPart4.gif">';
  2258.                 }
  2259.             Label_cell.style.backgroundImage = "url('Pics/TabCaptionMid1.gif')";
  2260.             what_before = "unactive";
  2261.             }
  2262.             else
  2263.             {
  2264.             Active_was_found = true;
  2265.             G_ActiveAssociationID = 'Association'+i+'ID';
  2266.             if(what_before == "unactive")
  2267.                 {
  2268.                 separator_cell.innerHTML = '<img src="Pics/TabCaptionPart6.gif">';
  2269.                 }
  2270.                 else if(what_before == "empty")
  2271.                 {
  2272.                 separator_cell.innerHTML = '<img src="Pics/TabCaptionPart2.gif">';
  2273.                 }
  2274.             Label_cell.style.backgroundImage = "url('Pics/TabCaptionMid2.gif')";
  2275.             what_before = "active";
  2276.             }
  2277.         Label_cell.noWrap = true;
  2278.         Label_cell.innerHTML = 'Association #'+i;
  2279.         Label_cell.id = 'Association'+i+'ID';
  2280.         Label_cell.onmousedown = TabLabelOnClick;
  2281.         Label_cell.style.cursor = "hand";
  2282.         }
  2283.     End_separator_cell = TabsLabels.insertCell(0);
  2284.     if(what_before == "active")
  2285.         {
  2286.         End_separator_cell.innerHTML = '<img src="Pics/TabCaptionPart1.gif">';
  2287.         }
  2288.         else
  2289.         {
  2290.         End_separator_cell.innerHTML = '<img src="Pics/TabCaptionPart3.gif">';
  2291.         }    
  2292.     }
  2293.  
  2294. function Activate_form(num)
  2295.     {
  2296.     SyncTree_obj = document.getElementById('Association_'+G_ActiveAssociationID).all["SyncTree"+num];
  2297.         {    
  2298.         SyncTree_obj.className = "Active_panel";
  2299.         }
  2300.     }
  2301.     
  2302. function Deactivate_form(num)
  2303.     {
  2304.     ExtCloseHint(AssociationID, "Syncpath_hint_"+num);
  2305.     AssociationElement = document.getElementById('Association_'+G_ActiveAssociationID);
  2306.     SyncTree_elem = AssociationElement.all["SyncTree"+num];
  2307.     Form_elem = AssociationElement.all["TreeForm"+num];
  2308.     if(Form_elem.is_changed == "false")
  2309.         {
  2310.         SyncTree_elem.className = "Unactive_panel";
  2311.         }
  2312.     else if(SyncTree_elem.contains(window.event.toElement) == false)
  2313.             {
  2314.             SyncTree_elem.className = "Unactive_panel";
  2315.             ChangeSyncTree(num);
  2316.             }
  2317.     }
  2318.  
  2319. function CancelSyncTree(num)    
  2320.     {
  2321.     SyncTree_elem = document.getElementById('Association_'+G_ActiveAssociationID).all["SyncTree"+num];
  2322.     SyncTree_elem.className = "Unactive_panel";
  2323.     GetBackSyncBoard(num);
  2324.     }
  2325.     
  2326. function BrowseSyncTree(num)
  2327.     {
  2328.     SyncTree_elem = document.getElementById('Association_'+G_ActiveAssociationID).all["SyncTree"+num];
  2329.     SyncTreeID = SyncTree_elem.synctree_id;
  2330.     SyncTree_elem.className = "Unactive_panel";
  2331.     G_OnProfileChanged_called = false;
  2332.     external.Method1ID('M_BrowseButtonPressedForTree', SyncTreeID);
  2333.     if(G_OnProfileChanged_called == false)
  2334.             {
  2335.             GetBackSyncBoard(num);
  2336.             }
  2337.     }
  2338.  
  2339. function OpenSyncTree(num)
  2340.     {
  2341.     SyncTree_elem = document.getElementById('Association_'+G_ActiveAssociationID).all["SyncTree"+num];
  2342.     SyncTreeID = SyncTree_elem.synctree_id;
  2343.     ChangeSyncTree(num);
  2344.     external.Method1ID('M_OpenButtonPressedForTree', SyncTreeID);
  2345.     }
  2346.  
  2347.  
  2348. function ChangeSyncTree(num)
  2349.     {
  2350.     ExtCloseHint(G_ActiveAssociationID, "Syncpath_hint_"+num);
  2351.     AssociationElement = document.getElementById('Association_'+G_ActiveAssociationID);
  2352.     SyncTree_elem = AssociationElement.all["SyncTree"+num];
  2353.     SyncTreeID = SyncTree_elem.synctree_id;
  2354.     SyncTree_elem.className = "Unactive_panel";
  2355.     Form_elem = AssociationElement.all["TreeForm"+num];
  2356.     if(Form_elem.is_changed == "true")
  2357.         {
  2358.         Form_elem.is_changed = "false";
  2359.         new_path = AssociationElement.all[SyncTreeID+'_path'].value;
  2360.         G_Associations[G_ActiveAssociationID].OnAssociationChangedCalled = false;
  2361.         solution = external.method0Own('M_GetSynchronizeProfileSolution');
  2362.         solution.SafeChangeTreePathAndUpdateProfile(SyncTreeID, new_path);
  2363.         if(G_Associations[G_ActiveAssociationID].OnAssociationChangedCalled == false)
  2364.             {
  2365.             GetBackSyncBoard(num);
  2366.             }
  2367.         }
  2368.     return false;
  2369.     }    
  2370.     
  2371.  
  2372. function Analyze_onclick() 
  2373. {
  2374.       AnalyzeButtonElement = window.event.srcElement;
  2375.       AssociationID = AnalyzeButtonElement.association_id;    
  2376.     ExtCloseHint(AssociationID, 'Analyze_hint');    
  2377.     AssociationObj = external.ObjByID(AssociationID);
  2378.     AssociationObj.CommandAnalyze();
  2379. }
  2380.  
  2381. function Synchronize_onclick() 
  2382. {
  2383.       SynchronizeButtonElement = window.event.srcElement;
  2384.       AssociationID = SynchronizeButtonElement.association_id;    
  2385. //    ExtCloseHint(AssociationID, 'Synchronize_hint');    
  2386.     AssociationObj = external.ObjByID(AssociationID);
  2387.       AssociationObj.CommandSynchronize();
  2388. }
  2389.  
  2390. function Stop_onclick() 
  2391. {
  2392.       StopButtonElement = window.event.srcElement;
  2393.       AssociationID = StopButtonElement.association_id;    
  2394.     AssociationObj = external.ObjByID(AssociationID);
  2395.       AssociationObj.CommandStop();
  2396. }
  2397.  
  2398. function CloseAnalyzeHint()
  2399.     {
  2400.     AnalyzeButtonElement = window.event.srcElement;
  2401.     ExtCloseHint(AnalyzeButtonElement.association_id, 'Analyze_hint');
  2402.     }
  2403.     
  2404.     
  2405. function ExtUpdateButtons(AssociationID) 
  2406.     {
  2407.     AssociationElement = document.getElementById('Association_'+AssociationID);
  2408.     if(AssociationElement == null)
  2409.         {
  2410.         return;
  2411.         }
  2412.     AssociationObj = external.ObjByID(AssociationID);
  2413.     AssociationElement.all['B_ANALYZE'].disabled = !AssociationObj.StatusAnalyze;
  2414.     if(G_Associations[AssociationID].Folders_is_ready == true)
  2415.         {
  2416.         DisableFSP(AssociationID, 1, !AssociationObj.StatusAnalyze, true);
  2417.         DisableFSP(AssociationID, 2, !AssociationObj.StatusAnalyze, true);
  2418.         }
  2419.         else
  2420.         {
  2421.         DisableFSP(AssociationID, 1, false, G_Associations[AssociationID].Folder_1_is_ready);
  2422.         DisableFSP(AssociationID, 2, false, G_Associations[AssociationID].Folder_2_is_ready);
  2423.         }
  2424.       AssociationElement.all['B_SYNC'].disabled = !AssociationObj.StatusSynchronize;
  2425.       AssociationElement.all['B_STOP'].disabled = !AssociationObj.StatusStop;
  2426.     }
  2427.     
  2428. function DisableFSP(AssociationID, FSPnum, if_disabled, Open_is_enabled)
  2429.     {
  2430.     SyncTree_element = document.getElementById('Association_'+AssociationID).all["SyncTree"+FSPnum];
  2431.     SyncTree_element.all["TreePath"+FSPnum].disabled = if_disabled;
  2432.     SyncTree_element.all["TreeSubmitButtons"+FSPnum].disabled = if_disabled;
  2433.     SyncTree_element.all["TreeBrowse"+FSPnum].disabled = if_disabled;
  2434.     SyncTree_element.all["TreeOpen"+FSPnum].disabled = !Open_is_enabled; 
  2435.     }    
  2436.     
  2437. function ExtGiveHint(AssociationID, Hint_element_id)
  2438.     {
  2439.     if(AssociationID != G_ActiveAssociationID)
  2440.         {
  2441.         return;
  2442.         }
  2443.     hint_element = document.getElementById('Association_'+AssociationID).all[Hint_element_id];
  2444.     if(Hint_element_id == "Syncpath_hint_1")
  2445.         {
  2446.         hint_element.innerHTML = '<div style="position:absolute; top:0; left:0; width:25px; height:25px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'Pics/Hint_arrow1.png\'); z-index:10"></div>'+
  2447.                 '<div style="position:absolute; top:18; left:17; padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
  2448.                     external.LS("hint_syncpath_left")+'</div>';
  2449.         hint_element.style.visibility = "inherit";
  2450.         }
  2451.     else if(Hint_element_id == "Syncpath_hint_2")
  2452.         {
  2453.         hint_width = hint_element.offsetWidth-17;
  2454.         arrow_left = hint_element.offsetWidth-26;
  2455.         hint_element.innerHTML = '<div style="position:absolute; top:0; left:'+arrow_left+'; width:25px; height:25px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'Pics/Hint_arrow2.png\'); z-index:10"></div>'+
  2456.                 '<div style="position:absolute; top:18; left:0; width:'+hint_width+';padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
  2457.                     external.LS("hint_syncpath_right")+'</div>';
  2458.         hint_element.style.visibility = "inherit";
  2459.         }
  2460.     else if(Hint_element_id == "Analyze_hint")
  2461.         {
  2462.         hint_element.innerHTML = '<div style="position:relative; top:0; left:17; padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
  2463.                         external.LS("hint_analyze")+'</div>'+
  2464.                             '<div style="position:relative; left:0; right:0; width:250px; height:18px;">'+
  2465.                     '<div style="position:absolute; top:-8; left:0; width:25px; height:25px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'Pics/Hint_arrow3.png\'); z-index:10"></div></div>'
  2466.         hint_height = hint_element.offsetHeight;
  2467.         hint_element.style.top = -5-hint_height;
  2468.         hint_element.style.visibility = "inherit";
  2469.         }
  2470.     else if(Hint_element_id == "Synchronize_hint")
  2471.         {
  2472.         hint_element.innerHTML = '<div style="position:relative; top:0; left:17; padding:20px; background:cornsilk; border:solid 1px black; color: black;">'+
  2473.                         external.LS("hint_synchronize")+'</div>'+
  2474.                             '<div style="position:relative; left:0; right:0; width:250px; height:18px;">'+
  2475.                     '<img src="Pics/Hint_arrow3.gif" style="position:absolute; top:-8; left:0; z-index:10"></div>'
  2476.         hint_height = hint_element.offsetHeight;
  2477.         hint_element.style.top = -5-hint_height;
  2478.         hint_element.style.visibility = "inherit";
  2479.         }
  2480.     }
  2481.     
  2482. function ExtCloseHint(AssociationID, Hint_element_id)
  2483.     {
  2484.     hint_element = document.getElementById('Association_'+AssociationID).all[Hint_element_id];
  2485.     hint_element.innerHTML = "";
  2486.     hint_element.style.visibility = "hidden";
  2487.     }
  2488.     
  2489. function ScrollToImportant()
  2490.     {
  2491.     AssociationID = G_ActiveAssociationID;
  2492.     ImportantID = G_Associations[AssociationID].TreeView._collectionIdByName['Important'];
  2493.     if(G_Associations[AssociationID].TreeView.root._children[ImportantID]._expanded == 0)
  2494.         {
  2495.         OnCollectionExpandIconClick(AssociationID, ImportantID);
  2496.         }
  2497.     ImportantCollectionElement = document.getElementById('Association_'+AssociationID).all[ImportantID];
  2498.     ImportantCollectionElement.scrollIntoView(); 
  2499.     }
  2500.     
  2501. function TabsCaptionResized()
  2502.     {
  2503.     if(TabsCaption.scrollLeft>0)
  2504.         {
  2505.         LeftTabScroller.src = "Pics/TabCaptionScroller1.gif";
  2506.         LeftTabScroller.onmousedown = LeftTabScrollerDown;
  2507.         LeftTabScroller.onmouseup = TabScrollerReleased;
  2508.         LeftTabScroller.onmouseout = TabScrollerReleased;
  2509.         }
  2510.         else
  2511.         {
  2512.         LeftTabScroller.src = "Pics/TabCaptionScroller0.gif";
  2513.         LeftTabScroller.onmousedown = '';
  2514.         }
  2515.     if(TabsCaption.scrollWidth-TabsCaption.clientWidth-TabsCaption.scrollLeft >0)
  2516.         {
  2517.         RightTabScroller.src = "Pics/TabCaptionScroller2.gif";
  2518.         RightTabScroller.onmousedown = RightTabScrollerDown;
  2519.         RightTabScroller.onmouseup = TabScrollerReleased;
  2520.         RightTabScroller.onmouseout = TabScrollerReleased;
  2521.         }
  2522.         else
  2523.         {
  2524.         RightTabScroller.src = "Pics/TabCaptionScroller0.gif";
  2525.         RightTabScroller.onmousedown = '';
  2526.         }
  2527.     }
  2528.  
  2529. function TabLabelOnClick()
  2530.     {
  2531.     TabLabelClickedCell = window.event.srcElement;
  2532.     DeactivateAssociation(G_ActiveAssociationID);
  2533.     LabelID = TabLabelClickedCell.id;
  2534.     AssociationID = LabelID.replace(/Label_/,"");
  2535.     ActivateAssociation(AssociationID);
  2536.     }
  2537.  
  2538.  
  2539. function ScrollTabLabelIntoView(AssociationID)
  2540.     {
  2541.     LabelCell = TabsLabels.cells['Label_'+AssociationID];
  2542.     LeftLabelOut = TabsCaption.scrollLeft - LabelCell.offsetLeft+15;
  2543.     RightLabelOut = (LabelCell.offsetLeft+LabelCell.offsetWidth+16) - (TabsCaption.scrollLeft+TabsCaption.clientWidth);
  2544.     if((LeftLabelOut<0)&&(RightLabelOut<0))
  2545.         {
  2546.         return;
  2547.         }
  2548.         else if(LeftLabelOut<0)
  2549.         {
  2550.         ScrollTabToRightPixels(RightLabelOut);
  2551.         }
  2552.         else if(RightLabelOut<0)
  2553.         {
  2554.         ScrollTabToLeftPixels(LeftLabelOut);
  2555.         }
  2556.         else if((LeftLabelOut>0)&&(RightLabelOut>0))
  2557.         {
  2558.         if(LeftLabelOut > RightLabelOut)
  2559.             {
  2560.             ScrollTabToRigthPixels(RightLabelOut);
  2561.             }
  2562.             else
  2563.             {
  2564.             ScrollTabToLeftPixels(LeftLabelOut);
  2565.             }
  2566.         }
  2567.     }
  2568.  
  2569. function LeftTabScrollerDown()
  2570.     {
  2571.     G_TabScrollingProcessNum++;
  2572.     RightTabScroller.src = "Pics/TabCaptionScroller2.gif";
  2573.     RightTabScroller.onmousedown = RightTabScrollerDown;
  2574.     RightTabScroller.onmouseup = TabScrollerReleased;
  2575.     RightTabScroller.onmouseout = TabScrollerReleased;
  2576.     ScrollTabToLeft(G_TabScrollingProcessNum);
  2577.     }
  2578.             
  2579. function RightTabScrollerDown()
  2580.     {
  2581.     G_TabScrollingProcessNum++;
  2582.     LeftTabScroller.src = "Pics/TabCaptionScroller1.gif";
  2583.     LeftTabScroller.onmousedown = LeftTabScrollerDown;
  2584.     LeftTabScroller.onmouseup = TabScrollerReleased;
  2585.     LeftTabScroller.onmouseout = TabScrollerReleased;
  2586.     ScrollTabToRight(G_TabScrollingProcessNum);
  2587.     }
  2588.  
  2589. function TabScrollerReleased()
  2590.     {
  2591.     G_TabScrollingProcessNum++;
  2592.     }
  2593.  
  2594. function ScrollTabToLeft(ProcessNum)
  2595.     {
  2596.     if(ProcessNum == G_TabScrollingProcessNum)
  2597.         {
  2598.         if(TabsCaption.scrollLeft >5)
  2599.             {
  2600.             TabsCaption.scrollLeft -= 5;
  2601.             window.setTimeout("ScrollTabToLeft("+ProcessNum+")", 5);
  2602.             }
  2603.             else
  2604.             {
  2605.             TabsCaption.scrollLeft = 0;
  2606.             LeftTabScroller.src = "Pics/TabCaptionScroller0.gif";
  2607.             LeftTabScroller.onmousedown = '';
  2608.             }
  2609.         }
  2610.     }
  2611.  
  2612. function ScrollTabToRight(ProcessNum)
  2613.     {
  2614.     if(ProcessNum == G_TabScrollingProcessNum)
  2615.         {
  2616.         if(TabsCaption.scrollWidth-TabsCaption.clientWidth-TabsCaption.scrollLeft >5)
  2617.             {
  2618.             TabsCaption.scrollLeft += 5;
  2619.             window.setTimeout("ScrollTabToRight("+ProcessNum+")", 5);
  2620.             }
  2621.             else
  2622.             {    
  2623.             TabsCaption.scrollLeft = TabsCaption.scrollWidth-TabsCaption.clientWidth;
  2624.             RightTabScroller.src = "Pics/TabCaptionScroller0.gif";
  2625.             RightTabScroller.onmousedown = '';
  2626.             }
  2627.         }
  2628.     }
  2629.     
  2630. function ScrollTabToLeftPixels(PixelNumber)
  2631.     {
  2632.     if(PixelNumber > TabsCaption.scrollLeft)
  2633.         {
  2634.         PixelNumber = TabsCaption.scrollLeft;
  2635.         }
  2636. /*    if(PixelNumber > 10)
  2637.             {
  2638.             TabsCaption.scrollLeft -= 10;
  2639.             window.setTimeout("ScrollTabToLeftPixels("+(PixelNumber-10)+")", 5);
  2640.             }
  2641.             else    */    
  2642.             {    
  2643.             TabsCaption.scrollLeft = TabsCaption.scrollLeft-PixelNumber;
  2644.             TabsCaptionResized();
  2645.             }
  2646.     }
  2647.     
  2648. function ScrollTabToRightPixels(PixelNumber)
  2649.     {
  2650.     if(PixelNumber > TabsCaption.scrollWidth - TabsCaption.clientWidth - TabsCaption.scrollLeft)
  2651.         {
  2652.         PixelNumber = TabsCaption.scrollWidth - TabsCaption.clientWidth - TabsCaption.scrollLeft;
  2653.         }
  2654. /*    if(PixelNumber > 3)
  2655.             {
  2656.             TabsCaption.scrollLeft += 3;
  2657.             window.setTimeout("ScrollTabToRightPixels("+(PixelNumber-3)+")", 1);
  2658.             }
  2659.             else    */    
  2660.             {
  2661.             TabsCaption.scrollLeft = TabsCaption.scrollLeft+PixelNumber;
  2662.             TabsCaptionResized();
  2663.             }
  2664.     }    
  2665.  
  2666.  
  2667.  
  2668. function CloseAnalizeHint() 
  2669.     {
  2670.     AnalyzeButtonElement = window.event.srcElement;
  2671.       AssociationID = AnalyzeButtonElement.association_id;    
  2672.     ExtCloseHint(AssociationID, 'Analyze_hint');    
  2673.     }
  2674.  
  2675.  
  2676.  
  2677. function ExtAddNewAssociation()
  2678.     {
  2679.     NewAssociation();
  2680.     }
  2681.  
  2682. function ExtGetSelectedAssociation() 
  2683.     {
  2684.     if(G_ActiveAssociationID != '')
  2685.         {
  2686.          var ActiveAssociationObj = external.ObjByID(G_ActiveAssociationID);
  2687.         return ActiveAssociationObj;
  2688.         }
  2689.         else
  2690.         {
  2691.         return null;
  2692.         }
  2693.     } // return assocition (not obj ID)
  2694.     
  2695. function ExtSelectAssociation(AssociationObjID) 
  2696.     {
  2697.     DeactivateAssociation(G_ActiveAssociationID);
  2698.     ActivateAssociation(AssociationObjID);
  2699.     }
  2700.     
  2701. function RenameAssociation()
  2702.     {
  2703.     ExtAskNewAssociationName(G_ActiveAssociationID);
  2704.     }
  2705.  
  2706. function ExtAskNewAssociationName(AssociationID) 
  2707.     {
  2708. /*    LabelCell = TabsLabels.cells['Label_'+AssociationID];
  2709.     LabelCell.innerHTML = '<input type="text" value="" style="width:150px; border:none;">';
  2710.     window.setTimeout('TabsLabels.cells["Label_'+AssociationID+'].children(0).focus()',0);    */
  2711. //    alert('ExtAskNewAssociationName('+AssociationID+')');
  2712.     var AssociationObj = external.ObjByID(AssociationID);
  2713.     var OldName = AssociationObj.Method0('443EF11F46C9207C2C595B7B21499882');    //M_GetAssociationName
  2714.     var NewAssociationName = prompt('Association\'s new name:', OldName);
  2715.     if(NewAssociationName == null)
  2716.         {
  2717.         return;
  2718.         }
  2719.     if(NewAssociationName == '')
  2720.         {
  2721.         NewAssociationName = 'Association #'+G_LastAssociationNumber;
  2722.         G_LastAssociationNumber++;
  2723.         }
  2724.         else if(NewAssociationName == 'Association #'+G_LastAssociationNumber)
  2725.         {
  2726.         G_LastAssociationNumber++;
  2727.         }
  2728.     AssociationObj.Method1('45AB23FF99C4F08EFCD8EF9AFF1371B3', NewAssociationName);    //M_SetAssociationName
  2729.     var LabelCell = TabsLabels.cells['Label_'+AssociationID];
  2730.     LabelCell.innerText = NewAssociationName;
  2731.     } // call M_SetAssociationName
  2732.  
  2733.  
  2734.